Subject: Re: bug#35418: [PATCH] Don't poll auto-revert files that use notification

From: Eli Zaretskii <[email-masked]>
Date: Sat, 27 Apr 2019 19:52:56 +0300

> From: Mattias Engdegård <[email-masked]>
> Date: Sat, 27 Apr 2019 18:19:36 +0200
> Cc: Eli Zaretskii <[email-masked]>, [email-masked]
> 
> The reason is that file-notify does not call inotify-add-watch on individual files, as in your example above, but on their containing directory ("/tmp" in your example). When monitoring a directory with two hard links to the same file, and the file is changed, inotify (sensibly) only reports a change to one of the links (the one employed for the change). Thus, the logic is in the Linux kernel, not in filenotify.
> 
> For kqueue it is different: here, changes to files are not reported when a watch is monitoring their directory, so filenotify.el sets kqueue watches on each file instead. The same could be done with inotify (and w32notify, if I read the code right), but watching directories has certain advantages.

w32notify cannot watch a single file, because the Windows notification
machinery is directory-oriented, and reports all changes in the
directory.