diff options
| author | Karel Zak <kzak@redhat.com> | 2025-08-07 13:15:32 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2025-08-07 13:18:31 +0200 |
| commit | 489ebfe7046136ca02b6df7ec5b75f3daa2980fb (patch) | |
| tree | e5d386129d63bd754b05a6424e0a5afcd5ff6358 /libmount/src | |
| parent | f744e6391b1af5bb68e79b6e6d59f842450c2526 (diff) | |
| download | util-linux-489ebfe7046136ca02b6df7ec5b75f3daa2980fb.tar.gz | |
libmount: ifdef for fanotify support on older systems
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
| -rw-r--r-- | libmount/src/monitor_fanotify.c | 21 | ||||
| -rw-r--r-- | libmount/src/version.c | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/libmount/src/monitor_fanotify.c b/libmount/src/monitor_fanotify.c index 7e6903bebd..e9e6e64f66 100644 --- a/libmount/src/monitor_fanotify.c +++ b/libmount/src/monitor_fanotify.c @@ -14,6 +14,14 @@ #include "mountP.h" #include "monitor.h" +/* + * The fanotify info header is suppported since kernel v5.1 (commit 5e469c830fdb5). + * + * 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 + #include "strutils.h" #include "pathnames.h" @@ -319,3 +327,16 @@ err: DBG(MONITOR, ul_debugobj(mn, "failed to allocate fanotify monitor [rc=%d]", rc)); return rc; } + + +#else /* !HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER */ + +int mnt_monitor_enable_fanotify( + struct libmnt_monitor *mn __attribute__((__unused__)), + int enable __attribute__((__unused__)), + int ns __attribute__((__unused__))) +{ + errno = ENOTSUP; + return -errno; +} +#endif diff --git a/libmount/src/version.c b/libmount/src/version.c index 3b61618b55..19326d280c 100644 --- a/libmount/src/version.c +++ b/libmount/src/version.c @@ -49,6 +49,9 @@ static const char *lib_features[] = { #if defined(HAVE_STATX) && defined(HAVE_STRUCT_STATX) && defined(AT_STATX_DONT_SYNC) "statx", #endif +#ifdef HAVE_STRUCT_FANOTIFY_EVENT_INFO_HEADER + "fanotify", +#endif #if !defined(NDEBUG) "assert", /* libc assert.h stuff */ #endif |
