Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.

Commit 319172d

Browse files
kolyshkinDocker
authored and
Docker
committed
cloned_binary.c: allow to compile on trusty
It looks like Ubuntu Trusty * do not have linux/memfd.h header; * do not have memfd_create syscall number in unistd.h. Using linux-headers-generic-lts-xenial (that has kernel 4.4 headers) is problematic, as it's raw kernel headers (no symlink to the proper architecture etc). Fortunately we only need 3 defines, so let's just plug them in place. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent cd7a280 commit 319172d

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

libcontainer/nsenter/cloned_binary.c

+18-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,26 @@
1616
#include <sys/syscall.h>
1717

1818
#include <linux/magic.h>
19-
#include <linux/memfd.h>
19+
20+
/* flags for memfd_create(2) (unsigned int), taken from linux/memfd.h */
21+
#define MFD_CLOEXEC 0x0001U
22+
#define MFD_ALLOW_SEALING 0x0002U
2023

2124
/* Use our own wrapper for memfd_create. */
25+
#if !defined(__NR_memfd_create)
26+
# ifdef __i386__
27+
# define __NR_memfd_create 356
28+
# elif __x86_64__
29+
# define __NR_memfd_create 319
30+
# elif __powerpc64__
31+
# define __NR_memfd_create 360
32+
# elif __aarch64__
33+
# define __NR_memfd_create 279
34+
# elif __arm__
35+
# define __NR_memfd_create 385
36+
# endif
37+
#endif /* !__NR_memfd_create */
38+
2239
#if !defined(SYS_memfd_create) && defined(__NR_memfd_create)
2340
# define SYS_memfd_create __NR_memfd_create
2441
#endif

0 commit comments

Comments
 (0)