From: Karel Zak Date: Mon, 13 Feb 2023 13:25:26 +0000 (+0100) Subject: include: add fallback for statx X-Git-Tag: v2.39-rc1~81 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30c59d677fa54f72b5037df9c1bc2ba377a995cb;p=thirdparty%2Futil-linux.git include: add fallback for statx Fixes: https://github.com/util-linux/util-linux/pull/2065 Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index 675098d37f..9cb5f3e375 100644 --- a/configure.ac +++ b/configure.ac @@ -591,6 +591,7 @@ AC_CHECK_FUNCS([ \ setresuid \ sigqueue \ srandom \ + statx \ strnchr \ strndup \ strnlen \ diff --git a/include/fileutils.h b/include/fileutils.h index 16a7263d47..c71daf826f 100644 --- a/include/fileutils.h +++ b/include/fileutils.h @@ -81,8 +81,10 @@ static inline struct dirent *xreaddir(DIR *dp) return d; } + #ifdef HAVE_SYS_SYSCALL_H # include + # if defined(SYS_close_range) # include # 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 +# include +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) diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c index 1c5fcc8e79..958d5956ca 100644 --- a/libmount/src/hook_mount.c +++ b/libmount/src/hook_mount.c @@ -44,6 +44,7 @@ */ #include "mountP.h" +#include "fileutils.h" /* statx() fallback */ #include #ifdef USE_LIBMOUNT_MOUNTFD_SUPPORT diff --git a/meson.build b/meson.build index afb49bf233..bd1bbd4f66 100644 --- a/meson.build +++ b/meson.build @@ -531,6 +531,7 @@ funcs = ''' sched_setscheduler sigqueue srandom + statx strnchr strndup strnlen