Date: Sun, 14 Aug 2022 09:00:18 +0300 From: "Zeus Panchenko" <zeus@ibs.dn.ua> To: "=?us-ascii?Q?=3D=3FUTF-8=3FQ=3FMicha=3DC5=3D82=5FG=3DC3=3DB3rny=3F=3D?=" <mgorny@moritz.systems> Cc: "meator" <meator.dev@gmail.com>, "Gleb Popov" <arrowd@freebsd.org>, "freebsd-hackers" <freebsd-hackers@freebsd.org> Subject: Re: How to monitor a directory in FreeBSD? Message-ID: <20220814090018.68722@relay.xx> In-Reply-To: Your message of Sat, 13 Aug 2022 21:19:16 %2B0200 <0cb00216675d883162148e6dc1e0b90c4c8be5f2.camel@moritz.systems> References: <652f3c12-388c-04d0-ebeb-753b76b2b742@gmail.com> <CALH631m_q2VF8N4M%2ByCQVu4%2BeF6uue3TZ6KY%2BYzGc_zeWVa3bw@mail.gmail.com> <d65728ec-935f-a1bc-a519-b6c82ca78ea8@gmail.com> <0cb00216675d883162148e6dc1e0b90c4c8be5f2.camel@moritz.systems>
next in thread | previous in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220814090018.68722>
