fswatch
fswatch copied to clipboard
Add fanotify support
Linux Kernel 5.1 released and now it can handle all file events by fanotify https://github.com/amir73il/fsnotify-utils/wiki/Super-block-root-watch so fanotify support now can be added to fswatch
What is the opinion of the maintainers on fanotify? It seems the next step.
According to the fanotify's author (here), it provides "the ability to set a single (fanotify) watch on a root directory and get notified on all the legacy inotify events without the need to recursively add watches on all directories."
It was partially merged on mainstream kernel 5.1 and fully merged on 5.9 onwards.
Could we check the kernel version or the existence of fanotify and use it when available?
You could probably copy/paste my implementation, or significant portions of it.
https://github.com/e-dant/watcher/blob/release/devel/include/detail/wtr/watcher/adapter/linux/fanotify/watch.hpp
I'm not aware of any other reasonable implementations on GitHub.
There are a lot of... subtleties with getting fanotify running correctly. I hope there's enough documentation in there that you don't run into them yourself.
@e-dant Wow! Your project is a gem among the many watchers out there! Not only in regard to the OS APIs used, but to the code organization, excellent documentation, automated tests and even a cache!