]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Attempt to fix bionic builds of unmount-namespace
authorStéphane Graber <stgraber@ubuntu.com>
Sun, 11 Oct 2015 17:07:52 +0000 (13:07 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 11 Oct 2015 17:07:52 +0000 (13:07 -0400)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
hooks/unmount-namespace.c

index 488c9ccc82d60cfcb855e9982703bb92eded5bb8..86513ac9b9f7c0cb027212d44416374d2f3650ad 100644 (file)
 #include <mntent.h>    /* getmntent, endmntent */
 #include <errno.h>     /* errno */
 
+#include <../src/config.h>
+
+#if IS_BIONIC
+#include <../src/include/lxcmntent.h>
+#else
+#include <mntent.h>
+#endif
+
+#ifndef O_PATH
+#define O_PATH      010000000
+#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
+
 struct mount {
        char *src; /* currently not used */
        char *dst;