freebsd: FreeBSD 15 has native inotify
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> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Warner Losh <imp@bsdimp.com>
Warner Losh committed
Feb 6, 2026 at 09:00 UTC
bba2f724f13ed610847d731b4f738cccb0bb9fb6
2 files changed
+6
-14
meson.build
+5
-9
@@ -2664,18 +2664,14 @@ else
2664
endif
2665
config_host_data.set('CONFIG_ASAN_IFACE_FIBER', have_asan_fiber)
2666
2667
+inotify = not_found
2668
have_inotify_init = cc.has_header_symbol('sys/inotify.h', 'inotify_init')
2669
have_inotify_init1 = cc.has_header_symbol('sys/inotify.h', 'inotify_init1')
2669
-inotify = not_found
2670
-if (have_inotify_init or have_inotify_init1) and host_os == 'freebsd'
2671
- # libinotify-kqueue
2670
+if (have_inotify_init or have_inotify_init1) and not cc.has_function('inotify_init1')
2671
+ # FreeBSD 14 and older need libinotify-kqueue wrapper
2672
inotify = cc.find_library('inotify')
2673
- if have_inotify_init
2674
- have_inotify_init = inotify.found()
2675
- endif
2676
- if have_inotify_init1
2677
- have_inotify_init1 = inotify.found()
2678
- endif
2673
+ have_inotify_init = have_inotify_init and inotify.found()
2674
+ have_inotify_init1 = have_inotify_init1 and inotify.found()
2675
endif
2676
config_host_data.set('CONFIG_INOTIFY', have_inotify_init)
2677
config_host_data.set('CONFIG_INOTIFY1', have_inotify_init1)
util/meson.build
+1
-5
@@ -102,11 +102,7 @@ if have_block
102
util_ss.add(files('throttle.c'))
103
util_ss.add(files('timed-average.c'))
104
if config_host_data.get('CONFIG_INOTIFY1')
105
- freebsd_dep = []
106
- if host_os == 'freebsd'
107
- freebsd_dep = inotify
108
- endif
109
- util_ss.add(files('filemonitor-inotify.c'), freebsd_dep)
105
+ util_ss.add(files('filemonitor-inotify.c'), inotify)
106
else
107
util_ss.add(files('filemonitor-stub.c'))
108
endif