]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
syscall_wrappers: add pivot_root()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 30 Sep 2018 10:41:34 +0000 (12:41 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 30 Sep 2018 10:50:23 +0000 (12:50 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c
src/lxc/syscall_wrappers.h

index 8e98f7ee4095bdb58d3e66c39ab6b45061a98954..01c1e3f5d2d15a537e4563f6c867140988e0ab6f 100644 (file)
@@ -74,6 +74,7 @@
 #include "start.h"
 #include "storage.h"
 #include "storage/overlay.h"
+#include "syscall_wrappers.h"
 #include "terminal.h"
 #include "utils.h"
 
@@ -124,21 +125,6 @@ thread_local struct lxc_conf *current_config;
 struct lxc_conf *current_config;
 #endif
 
-/* Define pivot_root() if missing from the C library */
-#ifndef HAVE_PIVOT_ROOT
-static int pivot_root(const char *new_root, const char *put_old)
-{
-#ifdef __NR_pivot_root
-       return syscall(__NR_pivot_root, new_root, put_old);
-#else
-       errno = ENOSYS;
-       return -1;
-#endif
-}
-#else
-extern int pivot_root(const char *new_root, const char *put_old);
-#endif
-
 char *lxchook_names[NUM_LXC_HOOKS] = {
        "pre-start",
        "pre-mount",
index 4692cea5998a7720c8eff942a97ac26ab0757a23..a6c7694d908db29a25c05a1fd322b13a4026f8a5 100644 (file)
@@ -48,4 +48,18 @@ static inline long __keyctl(int cmd, unsigned long arg2, unsigned long arg3,
 #define keyctl __keyctl
 #endif
 
+#if !HAVE_PIVOT_ROOT
+static int pivot_root(const char *new_root, const char *put_old)
+{
+#ifdef __NR_pivot_root
+       return syscall(__NR_pivot_root, new_root, put_old);
+#else
+       errno = ENOSYS;
+       return -1;
+#endif
+}
+#else
+extern int pivot_root(const char *new_root, const char *put_old);
+#endif
+
 #endif /* __LXC_SYSCALL_WRAPPER_H */