]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - include/namespace.h
3 * No copyright is claimed. This code is in the public domain; do with
6 * Compat code so unshare and setns can be used with older libcs
8 #ifndef UTIL_LINUX_NAMESPACE_H
9 # define UTIL_LINUX_NAMESPACE_H
14 # define CLONE_NEWNS 0x00020000
16 # ifndef CLONE_NEWCGROUP
17 # define CLONE_NEWCGROUP 0x02000000
20 # define CLONE_NEWUTS 0x04000000
23 # define CLONE_NEWIPC 0x08000000
26 # define CLONE_NEWNET 0x40000000
28 # ifndef CLONE_NEWUSER
29 # define CLONE_NEWUSER 0x10000000
32 # define CLONE_NEWPID 0x20000000
34 # ifndef CLONE_NEWTIME
35 # define CLONE_NEWTIME 0x00000080
38 # if !defined(HAVE_UNSHARE) || !defined(HAVE_SETNS)
39 # include <sys/syscall.h>
42 # if !defined(HAVE_UNSHARE) && defined(SYS_unshare)
43 static inline int unshare(int flags
)
45 return syscall(SYS_unshare
, flags
);
49 # if !defined(HAVE_SETNS) && defined(SYS_setns)
50 static inline int setns(int fd
, int nstype
)
52 return syscall(SYS_setns
, fd
, nstype
);
56 #endif /* UTIL_LINUX_NAMESPACE_H */