diff options
| author | Michael Albinus | 2023-10-10 19:51:22 +0200 |
|---|---|---|
| committer | Michael Albinus | 2023-10-10 19:51:22 +0200 |
| commit | f7185ca29b5086b1b0f32e64b7a5ba0bc21152c8 (patch) | |
| tree | d49081a3d1523e43beb3deea51eeec3a9562f13a /src/kqueue.c | |
| parent | 294567d171c9f1fbc961ea43c899269f46140570 (diff) | |
| download | emacs-f7185ca29b5086b1b0f32e64b7a5ba0bc21152c8.tar.gz emacs-f7185ca29b5086b1b0f32e64b7a5ba0bc21152c8.zip | |
File notifications report unmount events (bug#66381)
* doc/lispref/os.texi (File Notifications): Unmounting a watched
filesystem is reported now.
* etc/NEWS: File notifications report unmount events now.
Fix typos.
* lisp/filenotify.el (file-notify--callback-inotify)
(file-notify--add-watch-inotify): Handle `unmount'.
(file-notify--callback-kqueue, file-notify--add-watch-kqueue):
Handle `revoke'.
(file-notify--callback-gfilenotify): Handle `unmounted'.
(file-notify-callback): Handle `unmount' and `unmounted'.
(file-notify--add-watch-inotify):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch):
Handle `unmounted'.
* lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch):
Handle `unmount' and `unmounted'.
* src/gfilenotify.c (dir_monitor_callback): Handle Qunmounted.
* src/inotify.c (symbol_to_inotifymask): Handle IN_IGNORED and
IN_UNMOUNT.
* src/kqueue.c (kqueue_callback, Fkqueue_add_watch):
Handle NOTE_REVOKE.
(Fkqueue_add_watch): Adapt docstring.
(syms_of_kqueue): Declare `revoke.
Diffstat (limited to 'src/kqueue.c')
| -rw-r--r-- | src/kqueue.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/kqueue.c b/src/kqueue.c index 22c279b7ce3..43d5f40624b 100644 --- a/src/kqueue.c +++ b/src/kqueue.c | |||
| @@ -320,13 +320,16 @@ kqueue_callback (int fd, void *data) | |||
| 320 | directory is monitored. */ | 320 | directory is monitored. */ |
| 321 | if (kev.fflags & NOTE_RENAME) | 321 | if (kev.fflags & NOTE_RENAME) |
| 322 | actions = Fcons (Qrename, actions); | 322 | actions = Fcons (Qrename, actions); |
| 323 | if (kev.fflags & NOTE_REVOKE) | ||
| 324 | actions = Fcons (Qrevoke, actions); | ||
| 323 | 325 | ||
| 324 | /* Create the event. */ | 326 | /* Create the event. */ |
| 325 | if (! NILP (actions)) | 327 | if (! NILP (actions)) |
| 326 | kqueue_generate_event (watch_object, actions, file, Qnil); | 328 | kqueue_generate_event (watch_object, actions, file, Qnil); |
| 327 | 329 | ||
| 328 | /* Cancel monitor if file or directory is deleted or renamed. */ | 330 | /* Cancel monitor if file or directory is deleted or renamed or |
| 329 | if (kev.fflags & (NOTE_DELETE | NOTE_RENAME)) | 331 | the file system is unmounted. */ |
| 332 | if (kev.fflags & (NOTE_DELETE | NOTE_RENAME | NOTE_REVOKE)) | ||
| 330 | Fkqueue_rm_watch (descriptor); | 333 | Fkqueue_rm_watch (descriptor); |
| 331 | } | 334 | } |
| 332 | return; | 335 | return; |
| @@ -351,6 +354,7 @@ following symbols: | |||
| 351 | `attrib' -- a FILE attribute was changed | 354 | `attrib' -- a FILE attribute was changed |
| 352 | `link' -- a FILE's link count was changed | 355 | `link' -- a FILE's link count was changed |
| 353 | `rename' -- FILE was moved to FILE1 | 356 | `rename' -- FILE was moved to FILE1 |
| 357 | `revoke' -- FILE was unmounted | ||
| 354 | 358 | ||
| 355 | When any event happens, Emacs will call the CALLBACK function passing | 359 | When any event happens, Emacs will call the CALLBACK function passing |
| 356 | it a single argument EVENT, which is of the form | 360 | it a single argument EVENT, which is of the form |
| @@ -437,6 +441,7 @@ only when the upper directory of the renamed file is watched. */) | |||
| 437 | if (! NILP (Fmember (Qattrib, flags))) fflags |= NOTE_ATTRIB; | 441 | if (! NILP (Fmember (Qattrib, flags))) fflags |= NOTE_ATTRIB; |
| 438 | if (! NILP (Fmember (Qlink, flags))) fflags |= NOTE_LINK; | 442 | if (! NILP (Fmember (Qlink, flags))) fflags |= NOTE_LINK; |
| 439 | if (! NILP (Fmember (Qrename, flags))) fflags |= NOTE_RENAME; | 443 | if (! NILP (Fmember (Qrename, flags))) fflags |= NOTE_RENAME; |
| 444 | if (! NILP (Fmember (Qrevoke, flags))) fflags |= NOTE_REVOKE; | ||
| 440 | 445 | ||
| 441 | /* Register event. */ | 446 | /* Register event. */ |
| 442 | EV_SET (&kev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, | 447 | EV_SET (&kev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, |
| @@ -526,6 +531,7 @@ syms_of_kqueue (void) | |||
| 526 | DEFSYM (Qattrib, "attrib"); /* NOTE_ATTRIB */ | 531 | DEFSYM (Qattrib, "attrib"); /* NOTE_ATTRIB */ |
| 527 | DEFSYM (Qlink, "link"); /* NOTE_LINK */ | 532 | DEFSYM (Qlink, "link"); /* NOTE_LINK */ |
| 528 | DEFSYM (Qrename, "rename"); /* NOTE_RENAME */ | 533 | DEFSYM (Qrename, "rename"); /* NOTE_RENAME */ |
| 534 | DEFSYM (Qrevoke, "revoke"); /* NOTE_REVOKE */ | ||
| 529 | 535 | ||
| 530 | staticpro (&watch_list); | 536 | staticpro (&watch_list); |
| 531 | 537 | ||