]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
missing: add fsmount() syscall fallback definition
authorLennart Poettering <lennart@poettering.net>
Tue, 7 Mar 2023 13:36:03 +0000 (14:36 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Mar 2023 15:12:37 +0000 (16:12 +0100)
meson.build
src/basic/missing_syscall.h

index 6885884a003748f34f26711543e1c6cee1c3857e..4a5978453650b59f700ab51ea8d3efe6b68b6743 100644 (file)
@@ -629,6 +629,7 @@ foreach ident : [
         ['open_tree',         '''#include <sys/mount.h>'''],
         ['fsopen',            '''#include <sys/mount.h>'''],
         ['fsconfig',          '''#include <sys/mount.h>'''],
+        ['fsmount',           '''#include <sys/mount.h>'''],
         ['getdents64',        '''#include <dirent.h>'''],
 ]
 
index 98cd037962b47f5814e4e6eb8bedc1492cc8d9f9..3d66ab7d7a1d788904802840ae9b70ea911062dc 100644 (file)
@@ -609,6 +609,26 @@ static inline int missing_fsconfig(int fd, unsigned cmd, const char *key, const
 
 /* ======================================================================= */
 
+#if !HAVE_FSMOUNT
+
+#ifndef FSMOUNT_CLOEXEC
+#define FSMOUNT_CLOEXEC 0x00000001
+#endif
+
+static inline int missing_fsmount(int fd, unsigned flags, unsigned ms_flags) {
+#  if defined __NR_fsmount && __NR_fsmount >= 0
+        return syscall(__NR_fsmount, fd, flags, ms_flags);
+#  else
+        errno = ENOSYS;
+        return -1;
+#  endif
+}
+
+#  define fsmount missing_fsmount
+#endif
+
+/* ======================================================================= */
+
 #if !HAVE_GETDENTS64
 
 static inline ssize_t missing_getdents64(int fd, void *buffer, size_t length) {