From a407b232f06aa2f6d1031bf2d126725a4e9e2a54 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Tue, 9 Jan 2024 10:10:35 +0000 Subject: [PATCH] freebsd: fix build on non-intel archs (#4276) KINFO_FILE_SIZE is only defined on Intel archs. Fixes: https://github.com/libuv/libuv/issues/4274 --- src/unix/kqueue.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c index d7aa60e77ce..4d09edc06a0 100644 --- a/src/unix/kqueue.c +++ b/src/unix/kqueue.c @@ -493,7 +493,13 @@ static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags) { if (handle->event_watcher.fd != -1 && (!uv__fstat(handle->event_watcher.fd, &statbuf) && !(statbuf.st_mode & S_IFDIR))) { - kf.kf_structsize = KINFO_FILE_SIZE; + /* we are purposely not using KINFO_FILE_SIZE here + * as it is not available on non intl archs + * and here it gives 1392 too on intel. + * anyway, the man page also mentions we can proceed + * this way. + */ + kf.kf_structsize = sizeof(kf); if (fcntl(handle->event_watcher.fd, F_KINFO, &kf) == 0) path = uv__basename_r(kf.kf_path); }