FreeBSD: Select inotify type (libc or linotify) based on FreeBSD version (#3579)

Starting from FreeBSD 15.0-RELEASE, FreeBSD implemented inotify system calls. So, when the OS is FreeBSD, check the version (uname -U) and select to use libc (15.0-RELEASE and later) or independent library (until 14.3-RELEASE).

The FreeBSD implementation of inotify system calls do not support some of the flags that Linux equivalent supports, so modify the flags for FreeBSD.

Co-authored-by: Hiroo Ono <hiroo@oikumene.net>
Co-authored-by: abraunegg <alex.braunegg@gmail.com>
This commit is contained in:
Hiroo Ono 2025-12-24 06:01:14 +09:00 committed by GitHub
commit 40ed16bbe3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -298,7 +298,10 @@ case "$(uname -s)" in
bsd_inotify_LIBS=""
;;
FreeBSD)
bsd_inotify_LIBS="-L/usr/local/lib -linotify"
AS_IF([test "$(uname -U)" -gt 1500060],
[bsd_inotify_LIBS=""],
[bsd_inotify_LIBS="-L/usr/local/lib -linotify"]
)
;;
OpenBSD)
bsd_inotify_LIBS="-L/usr/local/lib/inotify -linotify"

View file

@ -29,7 +29,11 @@ import log;
import clientSideFiltering;
// Relevant inotify events
private immutable uint32_t mask = IN_CLOSE_WRITE | IN_CREATE | IN_DELETE | IN_MOVE | IN_IGNORED | IN_Q_OVERFLOW;
version(FreeBSD) {
private immutable uint32_t mask = IN_CLOSE_WRITE | IN_CREATE | IN_DELETE | IN_MOVE;
} else {
private immutable uint32_t mask = IN_CLOSE_WRITE | IN_CREATE | IN_DELETE | IN_MOVE | IN_IGNORED | IN_Q_OVERFLOW;
}
class MonitorException: ErrnoException {
@safe this(string msg, string file = __FILE__, size_t line = __LINE__) {