Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Oct 2010 12:02:57 +0200
From:      Ivan Voras <ivoras@freebsd.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: EVFILT_VNODE doesn't scale to large directory trees?
Message-ID:  <ia3kkf$b50$1@dough.gmane.org>
In-Reply-To: <AANLkTikc%2BtyBPuV=CdbaKPtznH3sLp8S9P-oPrRM4HJ2@mail.gmail.com>
References:  <AANLkTikc%2BtyBPuV=CdbaKPtznH3sLp8S9P-oPrRM4HJ2@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/25/10 03:05, Kenton Varda wrote:
> 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.

Short answer: no.

Long answer: There should be. There were past discussions on writing
such a facility to e.g. receive events for all files on per-mountpoint
basis (which you could filter...), but we're not there yet.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ia3kkf$b50$1>