* [PATCH] freebsd: FreeBSD 15 has native inotify @ 2026-02-10 15:43 Warner Losh 2026-02-10 15:54 ` Daniel P. Berrangé 0 siblings, 1 reply; 3+ messages in thread From: Warner Losh @ 2026-02-10 15:43 UTC (permalink / raw) To: qemu-devel Cc: Paolo Bonzini, Marc-André Lureau, Daniel P. Berrangé, Philippe Mathieu-Daudé, Warner Losh Check to make sure that we have inotify in libc, before looking for it in libinotify. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Daniel P. Berrange <berrange@redhat.com> Cc: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Warner Losh <imp@bsdimp.com> --- FreeBSD 15 and newer now has a native inotify implementation. Check for it before checking for the wrapper libinotify library which is needed in FreeBSD 14 and earlier. Make the check dependent on symbols, not host version. Separate series because it's really independent of the two other patch series I have submitted and it is more important. --- meson.build | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 2d114e9018..537f50283f 100644 --- a/meson.build +++ b/meson.build @@ -2662,13 +2662,15 @@ have_inotify_init = cc.has_header_symbol('sys/inotify.h', 'inotify_init') have_inotify_init1 = cc.has_header_symbol('sys/inotify.h', 'inotify_init1') inotify = not_found if (have_inotify_init or have_inotify_init1) and host_os == 'freebsd' - # libinotify-kqueue - inotify = cc.find_library('inotify') - if have_inotify_init - have_inotify_init = inotify.found() - endif - if have_inotify_init1 - have_inotify_init1 = inotify.found() + if not cc.has_function('inotify_init') and not cc.has_function('inotify_init1') + inotify = cc.find_library('inotify') + # libinotify-kqueue + if have_inotify_init + have_inotify_init = inotify.found() + endif + if have_inotify_init1 + have_inotify_init1 = inotify.found() + endif endif endif config_host_data.set('CONFIG_INOTIFY', have_inotify_init) --- base-commit: 0b91040d23dc8820724a60c811223b777f3bc6b7 change-id: 20260210-freebsd-inotify-8bd07b2c84d1 Best regards, -- Warner Losh <imp@bsdimp.com> ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] freebsd: FreeBSD 15 has native inotify 2026-02-10 15:43 [PATCH] freebsd: FreeBSD 15 has native inotify Warner Losh @ 2026-02-10 15:54 ` Daniel P. Berrangé 2026-02-10 18:22 ` Warner Losh 0 siblings, 1 reply; 3+ messages in thread From: Daniel P. Berrangé @ 2026-02-10 15:54 UTC (permalink / raw) To: Warner Losh Cc: qemu-devel, Paolo Bonzini, Marc-André Lureau, Philippe Mathieu-Daudé On Tue, Feb 10, 2026 at 08:43:48AM -0700, Warner Losh wrote: > Check to make sure that we have inotify in libc, before looking for it > in libinotify. > > Cc: Paolo Bonzini <pbonzini@redhat.com> > Cc: Marc-André Lureau <marcandre.lureau@redhat.com> > Cc: Daniel P. Berrange <berrange@redhat.com> > Cc: Philippe Mathieu-Daudé <philmd@linaro.org> > Signed-off-by: Warner Losh <imp@bsdimp.com> > --- > FreeBSD 15 and newer now has a native inotify implementation. Check for > it before checking for the wrapper libinotify library which is needed in > FreeBSD 14 and earlier. Make the check dependent on symbols, not host > version. > > Separate series because it's really independent of the two other > patch series I have submitted and it is more important. > --- > meson.build | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/meson.build b/meson.build > index 2d114e9018..537f50283f 100644 > --- a/meson.build > +++ b/meson.build > @@ -2662,13 +2662,15 @@ have_inotify_init = cc.has_header_symbol('sys/inotify.h', 'inotify_init') > have_inotify_init1 = cc.has_header_symbol('sys/inotify.h', 'inotify_init1') > inotify = not_found > if (have_inotify_init or have_inotify_init1) and host_os == 'freebsd' > - # libinotify-kqueue > - inotify = cc.find_library('inotify') > - if have_inotify_init > - have_inotify_init = inotify.found() > - endif > - if have_inotify_init1 > - have_inotify_init1 = inotify.found() > + if not cc.has_function('inotify_init') and not cc.has_function('inotify_init1') > + inotify = cc.find_library('inotify') > + # libinotify-kqueue > + if have_inotify_init > + have_inotify_init = inotify.found() > + endif > + if have_inotify_init1 > + have_inotify_init1 = inotify.found() > + endif > endif > endif > config_host_data.set('CONFIG_INOTIFY', have_inotify_init) So this ends up woth 'inotify == not_found' with either Linux, or latest FreeBSD 15. Over in util/meson.build though we have freebsd_dep = [] if host_os == 'freebsd' freebsd_dep = inotify endif util_ss.add(files('filemonitor-inotify.c'), freebsd_dep) Which seems to be trying to avoid adding "not_found" to the dep list. Either it is safe to add "not_found" to the dep list, and this code in util/meson.build can be simplified to just: util_ss.add(files('filemonitor-inotify.c'), [inotify]) or it is unsafe, and this code needs to be modified to look more like: inotify_deps = [] if inotify.found() inotify_deps = [inotify] endif util_ss.add(files('filemonitor-inotify.c'), inotify_deps) Assuming you've tested your patch here successfully, then it seems like the former case is valid, and we can simplify util/meson.dep to remove the conditional ? With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] freebsd: FreeBSD 15 has native inotify 2026-02-10 15:54 ` Daniel P. Berrangé @ 2026-02-10 18:22 ` Warner Losh 0 siblings, 0 replies; 3+ messages in thread From: Warner Losh @ 2026-02-10 18:22 UTC (permalink / raw) To: Daniel P. Berrangé Cc: qemu-devel, Paolo Bonzini, Marc-André Lureau, Philippe Mathieu-Daudé [-- Attachment #1: Type: text/plain, Size: 3487 bytes --] On Tue, Feb 10, 2026 at 8:54 AM Daniel P. Berrangé <berrange@redhat.com> wrote: > On Tue, Feb 10, 2026 at 08:43:48AM -0700, Warner Losh wrote: > > Check to make sure that we have inotify in libc, before looking for it > > in libinotify. > > > > Cc: Paolo Bonzini <pbonzini@redhat.com> > > Cc: Marc-André Lureau <marcandre.lureau@redhat.com> > > Cc: Daniel P. Berrange <berrange@redhat.com> > > Cc: Philippe Mathieu-Daudé <philmd@linaro.org> > > Signed-off-by: Warner Losh <imp@bsdimp.com> > > --- > > FreeBSD 15 and newer now has a native inotify implementation. Check for > > it before checking for the wrapper libinotify library which is needed in > > FreeBSD 14 and earlier. Make the check dependent on symbols, not host > > version. > > > > Separate series because it's really independent of the two other > > patch series I have submitted and it is more important. > > --- > > meson.build | 16 +++++++++------- > > 1 file changed, 9 insertions(+), 7 deletions(-) > > > > diff --git a/meson.build b/meson.build > > index 2d114e9018..537f50283f 100644 > > --- a/meson.build > > +++ b/meson.build > > @@ -2662,13 +2662,15 @@ have_inotify_init = > cc.has_header_symbol('sys/inotify.h', 'inotify_init') > > have_inotify_init1 = cc.has_header_symbol('sys/inotify.h', > 'inotify_init1') > > inotify = not_found > > if (have_inotify_init or have_inotify_init1) and host_os == 'freebsd' > > - # libinotify-kqueue > > - inotify = cc.find_library('inotify') > > - if have_inotify_init > > - have_inotify_init = inotify.found() > > - endif > > - if have_inotify_init1 > > - have_inotify_init1 = inotify.found() > > + if not cc.has_function('inotify_init') and not > cc.has_function('inotify_init1') > > + inotify = cc.find_library('inotify') > > + # libinotify-kqueue > > + if have_inotify_init > > + have_inotify_init = inotify.found() > > + endif > > + if have_inotify_init1 > > + have_inotify_init1 = inotify.found() > > + endif > > endif > > endif > > config_host_data.set('CONFIG_INOTIFY', have_inotify_init) > > So this ends up woth 'inotify == not_found' with either Linux, > or latest FreeBSD 15. > yes. And that turns out to be fine... > Over in util/meson.build though we have > > freebsd_dep = [] > if host_os == 'freebsd' > freebsd_dep = inotify > endif > util_ss.add(files('filemonitor-inotify.c'), freebsd_dep) > > Which seems to be trying to avoid adding "not_found" to the dep list. > > Either it is safe to add "not_found" to the dep list, and this code in > util/meson.build can be simplified to just: > > util_ss.add(files('filemonitor-inotify.c'), [inotify]) > I don't think we need the [] here. It works without them on both FreeBSD 14 and 15. I tested on FreeBSD 14 with and without libinotify installed as well, and both work > or it is unsafe, and this code needs to be modified to look more like: > > inotify_deps = [] > if inotify.found() > inotify_deps = [inotify] > endif > util_ss.add(files('filemonitor-inotify.c'), inotify_deps) > > > Assuming you've tested your patch here successfully, then it seems like > the former case is valid, and we can simplify util/meson.dep to remove > the conditional ? > That's a nice simplification. I've played around a bit to simplify things a little elsewhere as well. I'll send a v2 here in a few monites. Warner [-- Attachment #2: Type: text/html, Size: 5019 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-10 18:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-02-10 15:43 [PATCH] freebsd: FreeBSD 15 has native inotify Warner Losh 2026-02-10 15:54 ` Daniel P. Berrangé 2026-02-10 18:22 ` Warner Losh
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.