Author: Dharanendiran <dharanendiran@timesys.com>
Date: Wed, 7 Oct 2026 22:41:06 +0530

Error log:

libmount/src/hook_mount.c:314:6: note: each undeclared identifier is reported only once for each function it appears in
make[3]: *** [Makefile:12766: libmount/src/la-hook_mount.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
libmount/src/monitor_fanotify.c:29:10: fatal error: sys/fanotify.h: No such file or directory
   29 | #include <sys/fanotify.h>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.

---
 config.h.in                     |  2 ++
 configure                       | 12 ++++++++++++
 libmount/src/monitor_fanotify.c |  2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/config.h.in b/config.h.in
index cbdbd39..7bd9091 100644
--- a/config.h.in
+++ b/config.h.in
@@ -697,6 +697,8 @@
    */
 #undef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER
 
+#undef HAVE_SYS_FANOTIFY_H
+
 /* Define to 1 if the system has the type 'struct mount_attr'. */
 #undef HAVE_STRUCT_MOUNT_ATTR
 
diff --git a/configure b/configure
index b469abe..1ac22a9 100755
--- a/configure
+++ b/configure
@@ -27921,6 +27921,18 @@ printf "%s\n" "#define HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER 1" >>confdefs.h
 
 fi
 
+for ac_header in sys/fanotify.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/fanotify.h" "ac_cv_header_sys_fanotify_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_fanotify_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_FANOTIFY_H 1
+_ACEOF
+
+fi
+
+done
+
 
 ac_fn_c_check_type "$LINENO" "struct mount_attr" "ac_cv_type_struct_mount_attr" "#include <linux/mount.h>
 "
diff --git a/libmount/src/monitor_fanotify.c b/libmount/src/monitor_fanotify.c
index da54947..819c013 100644
--- a/libmount/src/monitor_fanotify.c
+++ b/libmount/src/monitor_fanotify.c
@@ -20,7 +20,7 @@
  * We do not provide fallback for so old systems. There is fallback only for
  * missing "struct fanotify_event_info_mnt" (since v6.15, commit 0f46d81f2bce9).
  */
-#ifdef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER
+#if defined(HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER) && defined(HAVE_SYS_FANOTIFY_H)
 
 #include "strutils.h"
 #include "pathnames.h"
-- 
2.25.1

