EVFILT_VNODE doesn't scale to large directory trees?

Kenton Varda temporal at gmail.com
Mon Oct 25 01:27:18 UTC 2010


Hi all,

I am trying to write some code which monitors a possibly-large directory
tree for changes.  Specifically, it's a build system, and I want it to
automatically start rebuilding whenever I modify a source file.

So far the approach I've taken is to use EVFILT_VNODE to watch every file
and directory in the tree.  This seems to work OK so far, but it worries me
that I have to open() every single file.  When I ran the same code on
Darwin, it promptly hit the open file descriptor limit, and I'm worried that
FreeBSD will do the same on larger code trees.

Is there any better way to accomplish this?  Hate to say it, but Linux's
inotify() seems more scalable here.  From what I can tell from the docs, it
doesn't require opening the watched files and it will even watch all files
in a directory with one call.

-Kenton


More information about the freebsd-questions mailing list