]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
syscalls: add fsmount()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 22 Jul 2020 09:02:33 +0000 (11:02 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 23 Jul 2020 08:20:50 +0000 (10:20 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
configure.ac
src/lxc/syscall_numbers.h
src/lxc/syscall_wrappers.h

index 8178a4452eeb1c6d52f7d882be6946fd389d27b5..70099e3ad07a83240bc0d9c26bdb2122304df306 100644 (file)
@@ -622,7 +622,7 @@ AC_CHECK_HEADER([ifaddrs.h],
 AC_HEADER_MAJOR
 
 # Check for some syscalls functions
-AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create move_mount open_tree execveat clone3 fsopen fspick fsconfig])
+AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create move_mount open_tree execveat clone3 fsopen fspick fsconfig fsmount])
 AC_CHECK_TYPES([struct clone_args], [], [], [[#include <linux/sched.h>]])
 AC_CHECK_MEMBERS([struct clone_args.set_tid],[],[],[[#include <linux/sched.h>]])
 AC_CHECK_MEMBERS([struct clone_args.cgroup],[],[],[[#include <linux/sched.h>]])
index 0cc2d674267a3e055c5b79355c5f3868ed32344b..e2e78837867cf07230fb303f53ca2ac8c671d8ac 100644 (file)
        #endif
 #endif
 
+#ifndef __NR_fsmount
+       #if defined __alpha__
+               #define __NR_fsmount 542
+       #elif defined _MIPS_SIM
+               #if _MIPS_SIM == _MIPS_SIM_ABI32        /* o32 */
+                       #define __NR_fsmount 4432
+               #endif
+               #if _MIPS_SIM == _MIPS_SIM_NABI32       /* n32 */
+                       #define __NR_fsmount 6432
+               #endif
+               #if _MIPS_SIM == _MIPS_SIM_ABI64        /* n64 */
+                       #define __NR_fsmount 5432
+               #endif
+       #elif defined __ia64__
+               #define __NR_fsmount (432 + 1024)
+       #else
+               #define __NR_fsmount 432
+       #endif
+#endif
+
 #endif /* __LXC_SYSCALL_NUMBERS_H */
index aeb1db8ac98865ada12deb03442443043acb96e3..220ef65fded843c884986f4aaeb4f2bc14270f41 100644 (file)
@@ -191,4 +191,14 @@ static inline int fsconfig_lxc(int fd, unsigned int cmd, const char *key, const
 extern int fsconfig(int fd, unsigned int cmd, const char *key, const void *value, int aux);
 #endif
 
+#ifndef HAVE_FSMOUNT
+static inline int fsmount_lxc(int fs_fd, unsigned int flags, unsigned int attr_flags)
+{
+       return syscall(__NR_fsmount, fs_fd, flags, attr_flags);
+}
+#define fsmount fsmount_lxc
+#else
+extern int fsmount(int fs_fd, unsigned int flags, unsigned int attr_flags);
+#endif
+
 #endif /* __LXC_SYSCALL_WRAPPER_H */