]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
syscall_wrappers: move setns()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 3 Oct 2018 10:57:32 +0000 (12:57 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 3 Oct 2018 10:57:32 +0000 (12:57 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/Makefile.am
src/lxc/attach.c
src/lxc/cmd/lxc_user_nic.c
src/lxc/network.c
src/lxc/start.c
src/lxc/syscall_wrappers.h
src/lxc/utils.h

index 2011a6c021f34627738e279529df7d39594230df..208a485e18efcb278cfaa5c25eadcb510b807bb4 100644 (file)
@@ -360,7 +360,8 @@ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \
                       log.c log.h \
                       network.c network.h \
                       parse.c parse.h \
-                      raw_syscalls.c raw_syscalls.h
+                      raw_syscalls.c raw_syscalls.h \
+                      syscall_wrappers.h
 lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \
                         conf.c conf.h \
                         list.h \
index 437001079e1f04a4e92f8ed6387c9ec18764cf66..689cef7090371c88f6d6b19cb0eb3a3778533829 100644 (file)
@@ -60,6 +60,7 @@
 #include "mainloop.h"
 #include "namespace.h"
 #include "raw_syscalls.h"
+#include "syscall_wrappers.h"
 #include "terminal.h"
 #include "utils.h"
 
index 6d70111363aca854ea85d2c61f41215370a9d888..02915b882fc5efcdcedeeca57275a7b501bba561 100644 (file)
@@ -52,6 +52,7 @@
 #include "network.h"
 #include "parse.h"
 #include "raw_syscalls.h"
+#include "syscall_wrappers.h"
 #include "utils.h"
 
 #ifndef HAVE_STRLCPY
index 3ed35afd4d352e64aae0a7bb5033bbd2448fe2d0..df1989272aea7a3267705f76af5e04612489cc0f 100644 (file)
@@ -57,6 +57,7 @@
 #include "network.h"
 #include "nl.h"
 #include "raw_syscalls.h"
+#include "syscall_wrappers.h"
 #include "utils.h"
 
 #ifndef HAVE_STRLCPY
index 5899ea07bfbf68750adbf128551ad8addc5f7195..17806704259d8fee404dae8f13178475ca5e783a 100644 (file)
@@ -75,6 +75,7 @@
 #include "storage/storage.h"
 #include "storage/storage_utils.h"
 #include "sync.h"
+#include "syscall_wrappers.h"
 #include "terminal.h"
 #include "utils.h"
 
index da376d58903092e391b0ee9a1904ba9cc4999912..b83ff68294d3b6446bba48a4c4396a2bc9bd1358 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 #include <asm/unistd.h>
 #include <linux/keyctl.h>
+#include <sched.h>
 #include <stdint.h>
 #include <sys/syscall.h>
 #include <sys/types.h>
@@ -110,4 +111,35 @@ static int pivot_root(const char *new_root, const char *put_old)
 extern int pivot_root(const char *new_root, const char *put_old);
 #endif
 
+#if !defined(__NR_setns) && !defined(__NR_set_ns)
+       #if defined(__x86_64__)
+               #define __NR_setns 308
+       #elif defined(__i386__)
+               #define __NR_setns 346
+       #elif defined(__arm__)
+               #define __NR_setns 375
+       #elif defined(__aarch64__)
+               #define __NR_setns 375
+       #elif defined(__powerpc__)
+               #define __NR_setns 350
+       #elif defined(__s390__)
+               #define __NR_setns 339
+       #endif
+#endif
+
+/* Define setns() if missing from the C library */
+#ifndef HAVE_SETNS
+static inline int setns(int fd, int nstype)
+{
+#ifdef __NR_setns
+       return syscall(__NR_setns, fd, nstype);
+#elif defined(__NR_set_ns)
+       return syscall(__NR_set_ns, fd, nstype);
+#else
+       errno = ENOSYS;
+       return -1;
+#endif
+}
+#endif
+
 #endif /* __LXC_SYSCALL_WRAPPER_H */
index 8c5914de7221441b846b5d04a553c4e732015388..5e70dec1a1bc05fd8c4f7d724ab380ad5ce6223a 100644 (file)
@@ -56,37 +56,6 @@ extern char *get_rundir(void);
 #endif
 #endif
 
-#if !defined(__NR_setns) && !defined(__NR_set_ns)
-       #if defined(__x86_64__)
-               #define __NR_setns 308
-       #elif defined(__i386__)
-               #define __NR_setns 346
-       #elif defined(__arm__)
-               #define __NR_setns 375
-       #elif defined(__aarch64__)
-               #define __NR_setns 375
-       #elif defined(__powerpc__)
-               #define __NR_setns 350
-       #elif defined(__s390__)
-               #define __NR_setns 339
-       #endif
-#endif
-
-/* Define setns() if missing from the C library */
-#ifndef HAVE_SETNS
-static inline int setns(int fd, int nstype)
-{
-#ifdef __NR_setns
-       return syscall(__NR_setns, fd, nstype);
-#elif defined(__NR_set_ns)
-       return syscall(__NR_set_ns, fd, nstype);
-#else
-       errno = ENOSYS;
-       return -1;
-#endif
-}
-#endif
-
 /* Define sethostname() if missing from the C library */
 #ifndef HAVE_SETHOSTNAME
 static inline int sethostname(const char *name, size_t len)