]>
Commit | Line | Data |
---|---|---|
c91280a4 EB |
1 | /* Compat code so unshare and setns can be used with older libcs */ |
2 | #ifndef UTIL_LINUX_NAMESPACE_H | |
a167328a | 3 | # define UTIL_LINUX_NAMESPACE_H |
c91280a4 | 4 | |
a167328a | 5 | # include <sched.h> |
c91280a4 | 6 | |
b00456d2 | 7 | # ifndef CLONE_NEWNS |
a167328a SK |
8 | # define CLONE_NEWNS 0x00020000 |
9 | # endif | |
f9e7b66d SH |
10 | # ifndef CLONE_NEWCGROUP |
11 | # define CLONE_NEWCGROUP 0x02000000 | |
12 | # endif | |
a167328a SK |
13 | # ifndef CLONE_NEWUTS |
14 | # define CLONE_NEWUTS 0x04000000 | |
15 | # endif | |
16 | # ifndef CLONE_NEWIPC | |
17 | # define CLONE_NEWIPC 0x08000000 | |
18 | # endif | |
19 | # ifndef CLONE_NEWNET | |
20 | # define CLONE_NEWNET 0x40000000 | |
21 | # endif | |
22 | # ifndef CLONE_NEWUSER | |
23 | # define CLONE_NEWUSER 0x10000000 | |
24 | # endif | |
25 | # ifndef CLONE_NEWPID | |
26 | # define CLONE_NEWPID 0x20000000 | |
27 | # endif | |
c91280a4 | 28 | |
5ad09239 | 29 | # if !defined(HAVE_UNSHARE) || !defined(HAVE_SETNS) |
a167328a | 30 | # include <sys/syscall.h> |
5ad09239 KZ |
31 | # endif |
32 | ||
6d791b4c | 33 | # if !defined(HAVE_UNSHARE) && defined(SYS_unshare) |
c91280a4 EB |
34 | static inline int unshare(int flags) |
35 | { | |
36 | return syscall(SYS_unshare, flags); | |
37 | } | |
a167328a | 38 | # endif |
c91280a4 | 39 | |
6d791b4c | 40 | # if !defined(HAVE_SETNS) && defined(SYS_setns) |
c91280a4 EB |
41 | static inline int setns(int fd, int nstype) |
42 | { | |
43 | return syscall(SYS_setns, fd, nstype); | |
44 | } | |
a167328a | 45 | # endif |
c91280a4 | 46 | |
a167328a | 47 | #endif /* UTIL_LINUX_NAMESPACE_H */ |