]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include: add fallback for statx
authorKarel Zak <kzak@redhat.com>
Mon, 13 Feb 2023 13:25:26 +0000 (14:25 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 13 Feb 2023 13:25:26 +0000 (14:25 +0100)
Fixes: https://github.com/util-linux/util-linux/pull/2065
Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
include/fileutils.h
libmount/src/hook_mount.c
meson.build

index 675098d37fcd844002172d022f86298e41a7bf1b..9cb5f3e3753c87d6bd7845d640d6fead0e8afa65 100644 (file)
@@ -591,6 +591,7 @@ AC_CHECK_FUNCS([ \
        setresuid \
        sigqueue \
        srandom \
+       statx \
        strnchr \
        strndup \
        strnlen \
index 16a7263d473657fa3a0852d8bc69bd69332d588e..c71daf826f185c24b0e375f5518261f21ba6037b 100644 (file)
@@ -81,8 +81,10 @@ static inline struct dirent *xreaddir(DIR *dp)
        return d;
 }
 
+
 #ifdef HAVE_SYS_SYSCALL_H
 # include <sys/syscall.h>
+
 # if defined(SYS_close_range)
 #  include <sys/types.h>
 #  ifndef HAVE_CLOSE_RANGE
@@ -93,8 +95,20 @@ static inline int close_range(unsigned int first, unsigned int last, int flags)
 #  endif
 #  define HAVE_CLOSE_RANGE 1
 # endif        /* SYS_close_range */
+
+# if !defined(HAVE_STATX) && defined(SYS_statx)
+#  include <fcntl.h>
+#  include <sys/stat.h>
+static inline int statx(int fd, const char *restrict path, int flags,
+                   unsigned int mask, struct statx *stx)
+{
+       return syscall(SYS_statx, fd, path, flags, mask, stx);
+}
+# endif /* SYS_statx */
+
 #endif /* HAVE_SYS_SYSCALL_H */
 
+
 extern void ul_close_all_fds(unsigned int first, unsigned int last);
 
 #define UL_COPY_READ_ERROR (-1)
index 1c5fcc8e79a5ef192959089cd9897a3b4f4a9876..958d5956cae4e3a33c90f76bb5c40a2554f45a97 100644 (file)
@@ -44,6 +44,7 @@
  */
 
 #include "mountP.h"
+#include "fileutils.h" /* statx() fallback */
 #include <inttypes.h>
 
 #ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT
index afb49bf23301628a0f82b6f18e5f0492084a3543..bd1bbd4f66e96a67a8d049423726b60b8fec08d4 100644 (file)
@@ -531,6 +531,7 @@ funcs = '''
         sched_setscheduler
         sigqueue
         srandom
+        statx
         strnchr
         strndup
         strnlen