inotify usage of FreeBSD
Closed this issue · 3 comments
I am not sure if it's supported, please close this issue if not.
I tried to build from source the master branch of ivykis on FreeBSD.
FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
I have libinotify installed
pkg info libinotify-20240724
libinotify-20240724
Name : libinotify
Version : 20240724
Installed on : Fri Sep 13 12:46:22 2024 CEST
Origin : devel/libinotify
Architecture : FreeBSD:14:amd64
When configuring ivykis
git clone https://github.com/buytenh/ivykis.git .
autoreconf --install
./configure
i found that inotify is not detected
checking for inotify_init... no
Is this a bug in the discovery, in my env, or is this not supported at all?
TIA!
seems to me an ivykis issue on detecting inotify presence
the relevant config.log part
configure:14694: checking for inotify_init
configure:14694: clang -o conftest -I/usr/local/include/ -Wall -L/usr/local/lib conftest.c >&5
ld: error: undefined symbol: inotify_init
>>> referenced by conftest.c
>>> /tmp/conftest-3e093f.o:(main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:14694: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "ivykis"
| #define PACKAGE_TARNAME "ivykis"
| #define PACKAGE_VERSION "0.43.2"
| #define PACKAGE_STRING "ivykis 0.43.2"
| #define PACKAGE_BUGREPORT "libivykis-discuss@lists.sourceforge.net"
| #define PACKAGE_URL ""
| #define PACKAGE "ivykis"
| #define VERSION "0.43.2"
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_UNISTD_H 1
| #define STDC_HEADERS 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_LIBC_NONSHARED 1
| #define HAVE_SYS_EVENTFD_H 1
| #define HAVE_SYS_SYSCALL_H 1
| #define HAVE_SYS_THR_H 1
| #define HAVE_PTHREAD_SPIN_TRYLOCK 1
| #define HAVE_PRAGMA_WEAK 1
| #define HAVE_CLOCK_GETTIME 1
| #define HAVE_CLOCK_MONOTONIC 1
| #define HAVE_CLOCK_MONOTONIC_FAST 1
| #define HAVE_CLOCK_REALTIME 1
| #define HAVE_EVENTFD 1
| /* end confdefs.h. */
| /* Define inotify_init to an innocuous variant, in case <limits.h> declares inotify_init.
| For example, HP-UX 11i <limits.h> declares gettimeofday. */
| #define inotify_init innocuous_inotify_init
|
| /* System header to define __stub macros and hopefully few prototypes,
| which can conflict with char inotify_init (void); below. */
|
| #include <limits.h>
| #undef inotify_init
|
| /* Override any GCC internal prototype to avoid an error.
| Use char because int might match the return type of a GCC
| builtin and then its argument prototype would still apply. */
| #ifdef __cplusplus
| extern "C"
| #endif
| char inotify_init (void);
| /* The GNU C library defines this for functions which it implements
| to always fail with ENOSYS. Some functions are actually named
| something starting with __ and the normal name is an alias. */
| #if defined __stub_inotify_init || defined __stub___inotify_init
| choke me
| #endif
|
| int
| main (void)
| {
| return inotify_init ();
| ;
| return 0;
| }
configure:14694: result: no
seems the inotify lib cannot be linked somehow, though it is presented
ls /usr/local/lib/libinot*
-rw-r--r-- 1 root wheel 52510 Sep 5 03:04 /usr/local/lib/libinotify.a
lrwxr-xr-x 1 root wheel 19 Sep 5 03:04 /usr/local/lib/libinotify.so -> libinotify.so.0.0.0
lrwxr-xr-x 1 root wheel 19 Sep 5 03:04 /usr/local/lib/libinotify.so.0 -> libinotify.so.0.0.0
-rwxr-xr-x 1 root wheel 29848 Sep 5 03:04 /usr/local/lib/libinotify.so.0.0.0
Some googling suggests that FreeBSD does not support inotify
directly
in the kernel like Linux does, and that libinotify
emulates the Linux
inotify
system call API on top of kqueue
.
The ivykis configure.ac
file assumes that if inotify
is supported on
the machine we are compiling on, inotify_init
can be called without
having to link against any particular libraries. This assumption holds
on Linux, but it would not hold on a FreeBSD system where libinotify
is used to provide the inotify
API.
I don't know whether libinotify
provides a compatible enough API for
ivykis to be able to make use of, but you could try adding an
AC_CHECK_LIB([inotify], [inotify_init])
directive to configure.ac
and then regenerating the various autoconf files to see if that makes
it work.
Yes, I guess (Free)BSD uses https://github.com/libinotify-kqueue/libinotify-kqueue that is a wrapper around kqueue.
I've built a version of syslog-ng based on the modified ivykis
, directory monitoring worked nicely (unfortunately there is no inotify
based file polling yet, so i could not test that)
So, I guess it could work seamlessly on BSD systems as well
But, meanwhile I turned off inotify usage of syslog-ng on (Free)BSD as
- the wrapped kqueue is already supported natively in ivykis, meaningless to have a wrapper around it
- ivykis currently supports only directory monitoring via inotify
I close this for now, thanks for your time!