emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master ad656a7 2/3: Restore inotify onlydir support


From: Paul Eggert
Subject: [Emacs-diffs] master ad656a7 2/3: Restore inotify onlydir support
Date: Sat, 27 May 2017 14:14:35 -0400 (EDT)

branch: master
commit ad656a726fc2683b0ca5683fcaaf6852f2c876b2
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Restore inotify onlydir support
    
    There was no need to remove it in the 2017-03-26 inotify change,
    as it is like IN_DONT_FOLLOW and does not affect other watchers
    for the same file.
    * src/inotify.c (symbol_to_inotifymask, Finotify_add_watch)
    (syms_of_inotify): Bring back onlydir.
---
 src/inotify.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/inotify.c b/src/inotify.c
index bcf30ad..b3e0728 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -72,10 +72,6 @@ static int inotifyfd = -1;
    IN_EXCL_UNLINK
    IN_MASK_ADD
    IN_ONESHOT
-   IN_ONLYDIR
-
-   FIXME: Explain why IN_ONLYDIR is in the list, as it seems to be
-   in the same category as IN_DONT_FOLLOW which is allowed.
 
    Each element of this list is of the form (DESCRIPTOR . WATCHES)
    where no two DESCRIPTOR values are the same.  DESCRIPTOR represents
@@ -162,6 +158,8 @@ symbol_to_inotifymask (Lisp_Object symb)
 
   else if (EQ (symb, Qdont_follow))
     return IN_DONT_FOLLOW;
+  else if (EQ (symb, Qonlydir))
+    return IN_ONLYDIR;
 
   else if (EQ (symb, Qt) || EQ (symb, Qall_events))
     return IN_ALL_EVENTS;
@@ -397,9 +395,11 @@ all-events or t
 move
 close
 
-The following symbols can also be added to a list of aspects:
+ASPECT can also contain the following symbols, which control whether
+the watch descriptor will be created:
 
 dont-follow
+onlydir
 
 Watching a directory is not recursive.  CALLBACK is passed a single argument
 EVENT which contains an event structure of the format
@@ -430,15 +430,14 @@ shared across different callers.
 
 IN_EXCL_UNLINK
 IN_MASK_ADD
-IN_ONESHOT
-IN_ONLYDIR  */)
+IN_ONESHOT  */)
      (Lisp_Object filename, Lisp_Object aspect, Lisp_Object callback)
 {
   Lisp_Object encoded_file_name;
   int wd = -1;
   uint32_t imask = aspect_to_inotifymask (aspect);
   uint32_t mask = (INOTIFY_DEFAULT_MASK
-                  | (imask & IN_DONT_FOLLOW));
+                  | (imask & (IN_DONT_FOLLOW | IN_ONLYDIR)));
 
   CHECK_STRING (filename);
 
@@ -548,6 +547,7 @@ syms_of_inotify (void)
   DEFSYM (Qclose, "close");            /* IN_CLOSE */
 
   DEFSYM (Qdont_follow, "dont-follow");        /* IN_DONT_FOLLOW */
+  DEFSYM (Qonlydir, "onlydir");                /* IN_ONLYDIR */
 
   DEFSYM (Qignored, "ignored");                /* IN_IGNORED */
   DEFSYM (Qisdir, "isdir");            /* IN_ISDIR */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]