From nobody Sun Aug 14 06:00:18 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M56H7535mz4Z4yV for ; Sun, 14 Aug 2022 06:01:23 +0000 (UTC) (envelope-from zeus@ibs.dn.ua) Received: from mx1.101011010.xyz (mx1.101011010.xyz [94.130.97.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mx1.101011010.xyz", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M56H72LPhz3MZv; Sun, 14 Aug 2022 06:01:22 +0000 (UTC) (envelope-from zeus@ibs.dn.ua) Received: by mx1.101011010.xyz with ESMTPS id 27E61I3n053348 on Sun, 14 Aug 2022 09:01:20 +0300 (EEST) DKIM-Signature: v=1;a=rsa-sha256;d=ibs.dn.ua;s=mail;c=relaxed/relaxed; q=dns/txt; h=From:From:Reply-To:Reply-To:Subject:Subject:Date:Date:To:Cc:Resent-Date :Resent-From:Resent-To:Resent-Cc:In-Reply-To:References:List-Id:List-Help :List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aQyriOXw/KAddV0wJhfIVYFHK/+5k4Z1d5wW91n+AKM=; b=NeQw4XQcMqwj+MTROoCEoxIm0jUzNn0W5/iilp5LZWqJp/dAuN3lp5UnNFPswMSsbgn3lsYnuFwL 3bth5UjgJ9qHvmXA2xZ3ZR4hp0JXjGm7OilztWoGKpC6rkEZzVnQXoe2HyOZQyMyDhZL3VzVFNGyFV Kad4urbea5YJfnGkNuXSgPcLre7Y4O9bdhUsXfwHZel66109nsEB9ySC7pX4Sa1lSoYXPBEwuCJ0g8 HHXvPrrUOsJaXBMaIsAhxBon3wZgvca6rzeqNTCzJFNPV+G/WvpBGvn5GQEwYzl3prn7ZKRm/g6wVa oiYbstZy+Aj8otl1A/f81cE+6tDRH5GQ==; Received: on behalf of honored client by relay.xx with ESMTPS id 27E60IZT068724 on Sun, 14 Aug 2022 09:00:19 +0300 (EEST) From: "Zeus Panchenko" To: "=?us-ascii?Q?=3D=3FUTF-8=3FQ=3FMicha=3DC5=3D82=5FG=3DC3=3DB3rny=3F=3D?=" Cc: "meator" , "Gleb Popov" , "freebsd-hackers" Subject: Re: How to monitor a directory in FreeBSD? In-reply-to: Your message of Sat, 13 Aug 2022 21:19:16 +0200 <0cb00216675d883162148e6dc1e0b90c4c8be5f2.camel@moritz.systems> References: <652f3c12-388c-04d0-ebeb-753b76b2b742@gmail.com> <0cb00216675d883162148e6dc1e0b90c4c8be5f2.camel@moritz.systems> Organization: I.B.S. LLC Reply-To: "Zeus Panchenko" X-Attribution: zeus Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEWxsbGdnZ3U1NQTExN cXFzx8fG/v7+f8hyWAAACXUlEQVQ4jUWSwXYiIRBFi4yyhtjtWpmRdTL0ZC3TJOukDa6Rc+T/P2F eFepwtFvr8upVFVDua8mLWw6La4VIKTuMdAPOebdU55sQs3n/D1xFFPFGVGh4AHKttr5K0bS6g7N ZCge7qpVLB+f1Z2WAj2OKXwIWt/bXpdXSiu8KXbviWkHxF5td9+lg2e3xlI2SCvatK8YLfHyh9lw 15yrad8Va5eXg4Llr7QmAaC+dL9sDt9iad/DX3OKvLMBf+dm0A0QuMrTvYIevSik1IaSVvgjIHt5 lSCG2ynNRpEcBZ8cgDWk+Ns99qzsYYV3MZoppWzGtYlTO9+meG6m/g92iNO9LfQB2JZsMpoJs7QG ku2KtabRK0bZRwDLyBDvwlxTm6ZlP7qyOqLcfqtLexpDSB4M0H3I/PQy1emvjjzgK+A0LmMKl6Lq zlqzh0VGAw440F6MJd8cY0nI7wiF/fVIBGY7UNCAXy6DmfYGCLLI0wtDbVcDUMqtJLmAhLqODQAe riERAxXJ1/QYGpa0ymqyytpKC19MNXHjvFmEsfcHIrncFR4xdbYWgmfEGLCcZokpGbGj1egMR+6M 1BkNX1pDdhPcOXpAnAeLQUwQLYepgQoZVNGS61yaE8CYA7gYAcWKzwGstACY2HTFvvOwk4FXAG/a mKHni/EcA/GkOk7I0IK7UMIf3+SahU8/FJdiE7KcuWdM3MFocUDEEIX9LfJoo4xV5tnNKc3jJuSs SZWgnnhepgU1zN4Hii18yW4RwDX52CXUtk0Hqz6cHOIUkWaX8fDcB+J7y1y2xDHwjv/8Buu8Ekz6 7tXQAAAAASUVORK5CYII= X-Mailer: MH-E 8.6+git; nil; GNU Emacs 27.2 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 14 Aug 2022 09:00:18 +0300 Message-ID: <20220814090018.68722@relay.xx> User-Agent: MH (GNU Mailutils 3.15) X-Relay-Agent: mailfromd (8.13) X-Relay-URL: https://mx1.101011010.xyz/smtp.html X-Relay-VirStat: UNCHECKED X-Relay-SpamStat: NO X-Relay-SpamScore: -2.300 of 3.500 X-Relay-SpamKeys: AWL,BAYES_00,NO_RECEIVED,NO_RELAYS,T_SCC_BODY_TEXT_LINE X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Rspamd-Queue-Id: 4M56H72LPhz3MZv X-Rspamd-Pre-Result: action=no action; module=multimap; Matched map: local_wl_ip X-Spamd-Result: default: False [0.00 / 15.00]; TAGGED_RCPT(0.00)[]; ASN(0.00)[asn:24940, ipnet:94.130.0.0/16, country:DE]; local_wl_ip(0.00)[94.130.97.216] X-ThisMailContainsUnwantedMimeParts: N may be, try to look on sysutils/direvent Micha=C5=82 G=C3=B3rny wrote: > On Sat, 2022-08-13 at 21:09 +0200, meator wrote: > > On 8/13/22 17:35, Gleb Popov wrote: > > >=20 > > > Yes, there is no native API to monitor directories. You can use=20 > > > libinotify from ports, which replicates Linux inotify API and it does= =20 > > > have ability to monitor directories. > > >=20 > >=20 > > I would like to avoid extra dependencies. If I would like to do this,=20 > > than I would probably choose FAM of Gamin. The Linux Programming=20 > > Interface book references these two as a more cross platform=20 > > alternatives to inotify. The program I'm working on should also work on= =20 > > Linux. I'm currently want to implement both inotify and kqueue and make= =20 > > the preprocessor pick the right one when compiling. > >=20 > > But I didn't know inotify for BSD exists. This would mean that I=20 > > wouldn't have to implement the directory monitoring twice. I'll take=20 > > this into consideration. Thanks! >=20 > 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. >=20 > --=20 > Best regards, > Micha=C5=82 G=C3=B3rny >=20 >=20 >=20 <#secure method=3Dpgp mode=3Dsign sender=3D0FF7A32A> --=20 Zeus V. Panchenko jid:zeus@im.ibs.dn.ua IT Dpt., I.B.S. LLC GMT+2 (EET)