aboutsummaryrefslogtreecommitdiffstats
path: root/src/inotify.c
diff options
context:
space:
mode:
authorPaul Eggert2017-05-27 10:54:25 -0700
committerPaul Eggert2017-05-27 11:14:30 -0700
commitad656a726fc2683b0ca5683fcaaf6852f2c876b2 (patch)
tree25175b9eb2caa5a5242a119923e3dc79b99faad3 /src/inotify.c
parent8f59ff2461b54e29c9389cee5851f348b867a281 (diff)
downloademacs-ad656a726fc2683b0ca5683fcaaf6852f2c876b2.tar.gz
emacs-ad656a726fc2683b0ca5683fcaaf6852f2c876b2.zip
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.
Diffstat (limited to 'src/inotify.c')
-rw-r--r--src/inotify.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/inotify.c b/src/inotify.c
index bcf30ad2b3c..b3e07286902 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -72,10 +72,6 @@ static int inotifyfd = -1;
72 IN_EXCL_UNLINK 72 IN_EXCL_UNLINK
73 IN_MASK_ADD 73 IN_MASK_ADD
74 IN_ONESHOT 74 IN_ONESHOT
75 IN_ONLYDIR
76
77 FIXME: Explain why IN_ONLYDIR is in the list, as it seems to be
78 in the same category as IN_DONT_FOLLOW which is allowed.
79 75
80 Each element of this list is of the form (DESCRIPTOR . WATCHES) 76 Each element of this list is of the form (DESCRIPTOR . WATCHES)
81 where no two DESCRIPTOR values are the same. DESCRIPTOR represents 77 where no two DESCRIPTOR values are the same. DESCRIPTOR represents
@@ -162,6 +158,8 @@ symbol_to_inotifymask (Lisp_Object symb)
162 158
163 else if (EQ (symb, Qdont_follow)) 159 else if (EQ (symb, Qdont_follow))
164 return IN_DONT_FOLLOW; 160 return IN_DONT_FOLLOW;
161 else if (EQ (symb, Qonlydir))
162 return IN_ONLYDIR;
165 163
166 else if (EQ (symb, Qt) || EQ (symb, Qall_events)) 164 else if (EQ (symb, Qt) || EQ (symb, Qall_events))
167 return IN_ALL_EVENTS; 165 return IN_ALL_EVENTS;
@@ -397,9 +395,11 @@ all-events or t
397move 395move
398close 396close
399 397
400The following symbols can also be added to a list of aspects: 398ASPECT can also contain the following symbols, which control whether
399the watch descriptor will be created:
401 400
402dont-follow 401dont-follow
402onlydir
403 403
404Watching a directory is not recursive. CALLBACK is passed a single argument 404Watching a directory is not recursive. CALLBACK is passed a single argument
405EVENT which contains an event structure of the format 405EVENT which contains an event structure of the format
@@ -430,15 +430,14 @@ shared across different callers.
430 430
431IN_EXCL_UNLINK 431IN_EXCL_UNLINK
432IN_MASK_ADD 432IN_MASK_ADD
433IN_ONESHOT 433IN_ONESHOT */)
434IN_ONLYDIR */)
435 (Lisp_Object filename, Lisp_Object aspect, Lisp_Object callback) 434 (Lisp_Object filename, Lisp_Object aspect, Lisp_Object callback)
436{ 435{
437 Lisp_Object encoded_file_name; 436 Lisp_Object encoded_file_name;
438 int wd = -1; 437 int wd = -1;
439 uint32_t imask = aspect_to_inotifymask (aspect); 438 uint32_t imask = aspect_to_inotifymask (aspect);
440 uint32_t mask = (INOTIFY_DEFAULT_MASK 439 uint32_t mask = (INOTIFY_DEFAULT_MASK
441 | (imask & IN_DONT_FOLLOW)); 440 | (imask & (IN_DONT_FOLLOW | IN_ONLYDIR)));
442 441
443 CHECK_STRING (filename); 442 CHECK_STRING (filename);
444 443
@@ -548,6 +547,7 @@ syms_of_inotify (void)
548 DEFSYM (Qclose, "close"); /* IN_CLOSE */ 547 DEFSYM (Qclose, "close"); /* IN_CLOSE */
549 548
550 DEFSYM (Qdont_follow, "dont-follow"); /* IN_DONT_FOLLOW */ 549 DEFSYM (Qdont_follow, "dont-follow"); /* IN_DONT_FOLLOW */
550 DEFSYM (Qonlydir, "onlydir"); /* IN_ONLYDIR */
551 551
552 DEFSYM (Qignored, "ignored"); /* IN_IGNORED */ 552 DEFSYM (Qignored, "ignored"); /* IN_IGNORED */
553 DEFSYM (Qisdir, "isdir"); /* IN_ISDIR */ 553 DEFSYM (Qisdir, "isdir"); /* IN_ISDIR */