Comments (6)
If you would not specify IN_ATTRIB IN_ACCESS IN_OPEN IN_CLOSE or IN_MODIFY flags than libinotify would not open all files and directories inside watched dir. Take a closer look at inotify_to_kqueue function in watch.c It shows you inotify -> kqueue flags conversion. Libinotify does not open file or directory when resulting kqueue flags set is empty
from libinotify-kqueue.
Err, but I do want to watch (and open) directories, just want to avoid files. Currently, the application does (for each directory in the library):
wd = open(dir_path, O_RDONLY | O_NONBLOCK);
EV_SET(&kev, wd, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_DELETE | NOTE_WRITE | NOTE_RENAME, 0, NULL);
So I think I especially would need a NOTE_WRITE on each dir, but also DELETE and RENAME. From looking at the code it doesn't seem possible to do that? Or maybe I misunderstood what you meant?
from libinotify-kqueue.
Libinotify does not analyse NOTE_DELETE or NOTE_RENAME events in subdirectories. It only analyses NOTE_WRITE event on parent directory and than does rereading and diffing of it content to get a list of renamed, deleted or created files.
from libinotify-kqueue.
Ah ok, I suppose NOTE_WRITE will be enough then. So if I do inotify_add_watch(fd, dir_path, 0) I will get a NOTE_WRITE on just the dir?
from libinotify-kqueue.
you should do something like inotify_add_watch(fd, dir_path, IN_CREATE | IN_DELETE | IN_MOVE) to get a NOTE_WRITE on "dir_path"
from libinotify-kqueue.
Thanks a million, this is exactly what I needed! I’ve tested it a bit, and it seems to work very well. Now I can switch to libinotify for FreeBSD, which should make the FreeBSD implementation much simpler and easier to maintain. :-)
from libinotify-kqueue.
Related Issues (18)
- libinotify open() considerations HOT 5
- Lost deletion events HOT 2
- The deletion events are not provided in time HOT 16
- Propagate changes from #12 to gio-kqueue
- use-after-free in worker_sets_extend/worker_update_flags HOT 2
- wulf7/libinotify-kqueue integration HOT 3
- Crashes reported for 271ef97 HOT 10
- [suggestion] Implement command line interface like 'inotifywait' in linux HOT 4
- Build failure: Missing file barriers.c
- incrond fails at monitoring directories HOT 10
- #include <sys/tree.h> is missing on FreeBSD HOT 8
- Test results: FreeBSD-10.2 HOT 6
- Mistakenly close down fd 0 upon watch failure HOT 4
- Where is the documentation? HOT 2
- Hanging while inotify_add_watch(): race conditions HOT 11
- "make test" sometimes gets killed with SIGPIPE HOT 3
- Doesn't set IN_ISDIR if new directory is created HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libinotify-kqueue.