Re: How to monitor a directory in FreeBSD?

From: Zeus Panchenko <zeus_at_ibs.dn.ua>
Date: Sun, 14 Aug 2022 06:00:18 UTC
may be, try to look on sysutils/direvent


Michał Górny <mgorny@moritz.systems> wrote:
> On Sat, 2022-08-13 at 21:09 +0200, meator wrote:
> > On 8/13/22 17:35, Gleb Popov wrote:
> > > 
> > > Yes, there is no native API to monitor directories. You can use 
> > > libinotify from ports, which replicates Linux inotify API and it does 
> > > have ability to monitor directories.
> > > 
> > 
> > I would like to avoid extra dependencies. If I would like to do this, 
> > than I would probably choose FAM of Gamin. The Linux Programming 
> > Interface book references these two as a more cross platform 
> > alternatives to inotify. The program I'm working on should also work on 
> > Linux. I'm currently want to implement both inotify and kqueue and make 
> > the preprocessor pick the right one when compiling.
> > 
> > But I didn't know inotify for BSD exists. This would mean that I 
> > wouldn't have to implement the directory monitoring twice. I'll take 
> > this into consideration. Thanks!
> 
> I'm afraid I'm going to be a bit of spoilsport but please bear in mind
> that inotify -- at least on Linux -- is not 100% reliable (or at least
> it wasn't the last time I've used it).  In general, it's a great
> optimization but your program also needs to have fallback logic to
> periodically check for changes that weren't reported.
> 
> -- 
> Best regards,
> Michał Górny
> 
> 
> 
<#secure method=pgp mode=sign sender=0FF7A32A>

-- 
Zeus V. Panchenko				jid:zeus@im.ibs.dn.ua
IT Dpt., I.B.S. LLC					  GMT+2 (EET)