From 4681fbac9061e887e355bf60f87226961db2cb89 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 26 May 2017 09:07:50 -0700 Subject: [PATCH] * src/inotify.c: Add FIXME comments. --- src/inotify.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/inotify.c b/src/inotify.c index d43b959747c..1165293d24c 100644 --- a/src/inotify.c +++ b/src/inotify.c @@ -41,21 +41,21 @@ along with GNU Emacs. If not, see . */ #ifndef IN_ONLYDIR # define IN_ONLYDIR 0 #endif + +/* Events that inotify-add-watch waits for. This list has all the + events that any watcher could include, because we want to support + multiple watches on the same file even though inotify uses the same + descriptor for all watches to that file. This list omits + IN_ACCESS, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, and IN_OPEN because + they would prevent other processes from reading; see Bug#26973. + + FIXME: Explain why it is OK to omit these four bits here even + though a inotify-add-watch call might specify them. */ + #define INOTIFY_DEFAULT_MASK \ - (IN_ATTRIB | \ - /* IN_ACCESS | */ \ - /* IN_CLOSE_WRITE | */ \ - /* IN_CLOSE_NOWRITE | */ \ - IN_CREATE | \ - IN_DELETE | \ - IN_DELETE_SELF | \ - IN_IGNORED | \ - IN_MODIFY | \ - IN_MOVE_SELF | \ - IN_MOVED_FROM | \ - IN_MOVED_TO | \ - /* IN_OPEN | */ \ - IN_EXCL_UNLINK) + (IN_ATTRIB | IN_CREATE | IN_DELETE | IN_DELETE_SELF \ + | IN_IGNORED | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM \ + | IN_MOVED_TO | IN_EXCL_UNLINK) /* File handle for inotify. */ static int inotifyfd = -1; @@ -74,6 +74,9 @@ static int inotifyfd = -1; 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 the inotify watch descriptor and WATCHES is a list with elements of @@ -423,8 +426,8 @@ See inotify(7) and inotify_add_watch(2) for further information. The inotify fd is managed internally and there is no corresponding inotify_init. Use `inotify-rm-watch' to remove a watch. -Also note, that the following inotify bit-masks can not be used, due -to the fact that descriptors are shared across different callers. +The following inotify bit-masks cannot be used because descriptors are +shared across different callers. IN_EXCL_UNLINK IN_MASK_ADD -- 2.39.2