Felix Palmen :freebsd: :c64:<p><span class="h-card" translate="no"><a href="https://friedcheese.us/users/feld" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>feld</span></a></span> <span class="h-card" translate="no"><a href="https://mastodon.bsd.cafe/@pertho" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>pertho</span></a></span> Doesn't feel like something I'd like to try though. It would be pretty much <a href="https://mastodon.bsd.cafe/tags/FreeBSD" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>FreeBSD</span></a>-specific, but worse than that, you shouldn't rely on dtrace availability, as it's an optionally loadable profiling tool (so, it would also be a "misuse" regarding purpose). Related to that, I'm pretty sure it requires superuser privileges for everything, which would be another issue for some general-purpose application software.</p><p>No, the "canonical" solution for filesystem watching on a BSD system is indeed <a href="https://mastodon.bsd.cafe/tags/kqueue" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>kqueue</span></a>. And unfortunately, it does fall short a bit compared to <a href="https://mastodon.bsd.cafe/tags/Linux" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Linux</span></a>' <a href="https://mastodon.bsd.cafe/tags/inotify" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>inotify</span></a>. For my <a href="https://mastodon.bsd.cafe/tags/xmoji" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>xmoji</span></a> tool, I wanted notifications about any change on the runtime configuration file, and additionally to the pure <a href="https://mastodon.bsd.cafe/tags/POSIX" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>POSIX</span></a> solution of periodically calling stat() (which is stupid, but still works for a single file), I implemented backends for both inotify and kqueue. For just a single file, kqueue's requirement of having an open file descriptor is just a minor annoyance, but you can deal with that. Note it's not as simple as it sounds in any case, e.g. when the file is deleted, you want to watch the directory of course, so you learn when it's re-created ... which with kqueue requires opendir() 🙈 ... still doable. But for scenarios where you want to watch a whole tree with potentially lots of files and directories, this is really bad and <a href="https://mastodon.bsd.cafe/tags/inotify" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>inotify</span></a> really shines.</p>