]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
meson: check for statmount and listmount syscalls
authorKarel Zak <kzak@redhat.com>
Wed, 14 Aug 2024 13:31:57 +0000 (15:31 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 8 Jan 2025 12:57:42 +0000 (13:57 +0100)
... keep statx stuff on one place.

Signed-off-by: Karel Zak <kzak@redhat.com>
meson.build

index c356107893979fe9d3064730b8907257851915a9..8dcc9c9cc8428c0bc7a008c7b590893e2347ee61 100644 (file)
@@ -103,8 +103,27 @@ have_mountfd_api = cc.has_type('struct mount_attr', prefix : '#include <linux/mo
 conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
 conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
 
+
 have_struct_statx = cc.has_type('struct statx', prefix : '#include <sys/stat.h>')
 conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
+have = cc.has_member('struct statx', 'stx_mnt_id',
+                     prefix : '#include <linux/stat.h>')
+conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
+
+
+have_statmount = cc.has_type('struct statmount', prefix : '#include <linux/mount.h>') > 0
+have_listmount = cc.has_header_symbol('linux/mount.h', 'LSMT_ROOT')
+
+# kernel headers provides the syscall, but there is not SYS_xxx yet
+if have_statmount and not cc.has_header_symbol('bits/syscall.h', 'SYS_statmount')
+  conf.set('SYS_statmount', '__NR_statmount')
+endif
+if have_listmount and not cc.has_header_symbol('bits/syscall.h', 'SYS_listmount')
+  conf.set('SYS_listmount', '__NR_listmount')
+endif
+
+conf.set('HAVE_STATMOUNT_API', have_statmount and have_listmount ? 1 : false)
+
 
 have_sys_vfs_header = cc.has_header('sys/vfs.h')
 
@@ -697,10 +716,6 @@ have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
                      prefix : '#include <sys/stat.h>')
 conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
 
-have = cc.has_member('struct statx', 'stx_mnt_id',
-                     prefix : '#include <sys/stat.h>')
-conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
-
 # replacement for AC_STRUCT_TIMEZONE
 have = cc.has_member('struct tm', 'tm_zone',
                      args : '-D_GNU_SOURCE',