Giter Club home page Giter Club logo

Comments (6)

wulf7 avatar wulf7 commented on August 19, 2024

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.

ejurgensen avatar ejurgensen commented on August 19, 2024

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.

wulf7 avatar wulf7 commented on August 19, 2024

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.

ejurgensen avatar ejurgensen commented on August 19, 2024

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.

wulf7 avatar wulf7 commented on August 19, 2024

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.

ejurgensen avatar ejurgensen commented on August 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.