The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6020
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === just an overview of the CentOS 6 related changes
From fc29bacc485467ad5cc18bfc8657ef41cc4d7a0b Mon Sep 17 00:00:00 2001 From: Marian Marinov <m...@yuhu.biz> Date: Sat, 27 Jul 2019 23:57:12 +0300 Subject: [PATCH 1/2] In order to build LXD on CentOS 6 we need setns() which is not provided by CentOS 6. We create a header namespaces.h which will be included in main_checkfeature.go and main_nsexec.go. The header defines the setns() function, on distros, that don't export it in their own headers. Signed-off-by: Marian Marinov <m...@yuhu.biz> --- lxd/include/namespaces.h | 17 +++++++++++++++++ lxd/main_checkfeature.go | 1 + lxd/main_nsexec.go | 1 + 3 files changed, 19 insertions(+) create mode 100644 lxd/include/namespaces.h diff --git a/lxd/include/namespaces.h b/lxd/include/namespaces.h new file mode 100644 index 0000000000..64e3bbab53 --- /dev/null +++ b/lxd/include/namespaces.h @@ -0,0 +1,17 @@ +#ifndef __NAMESPACES_H + +// 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 diff --git a/lxd/main_checkfeature.go b/lxd/main_checkfeature.go index e82a157379..8edb64f9e9 100644 --- a/lxd/main_checkfeature.go +++ b/lxd/main_checkfeature.go @@ -21,6 +21,7 @@ import ( #include "../shared/netutils/netns_getifaddrs.c" #include "include/memory_utils.h" +#include "include/namespaces.h" bool netnsid_aware = false; char errbuf[4096]; diff --git a/lxd/main_nsexec.go b/lxd/main_nsexec.go index df338e14da..2ad8a95e3d 100644 --- a/lxd/main_nsexec.go +++ b/lxd/main_nsexec.go @@ -34,6 +34,7 @@ package main #include <unistd.h> #include "include/memory_utils.h" +#include "include/namespaces.h" // External functions extern void checkfeature(); From 532990416631b72c7c0fbc0294331d883509fb83 Mon Sep 17 00:00:00 2001 From: Marian Marinov <m...@yuhu.biz> Date: Sat, 27 Jul 2019 23:59:26 +0300 Subject: [PATCH 2/2] Again in order to build LXD on CentOS 6 we need the O_PATH and AT_EMPTY_PATH definitions. These are borrowed from newer glibc headers. Signed-off-by: Marian Marinov <m...@yuhu.biz> --- shared/idmap/shift_linux.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shared/idmap/shift_linux.go b/shared/idmap/shift_linux.go index 11a2447955..801cefde0f 100644 --- a/shared/idmap/shift_linux.go +++ b/shared/idmap/shift_linux.go @@ -36,6 +36,15 @@ import ( #include "../../lxd/include/memory_utils.h" +#ifndef __O_PATH +#define __O_PATH 010000000 +#endif + +#ifndef O_PATH +#define O_PATH __O_PATH +#endif +#define AT_EMPTY_PATH 0x1000 + #ifndef VFS_CAP_REVISION_1 #define VFS_CAP_REVISION_1 0x01000000 #endif
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel