]> git.ipfire.org Git - thirdparty/util-linux.git/blob - include/namespace.h
findmnt: (verify) ignore passno for XFS
[thirdparty/util-linux.git] / include / namespace.h
1 /* Compat code so unshare and setns can be used with older libcs */
2 #ifndef UTIL_LINUX_NAMESPACE_H
3 # define UTIL_LINUX_NAMESPACE_H
4
5 # include <sched.h>
6
7 # ifndef CLONE_NEWNS
8 # define CLONE_NEWNS 0x00020000
9 # endif
10 # ifndef CLONE_NEWCGROUP
11 # define CLONE_NEWCGROUP 0x02000000
12 # endif
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
28
29 # if !defined(HAVE_UNSHARE) || !defined(HAVE_SETNS)
30 # include <sys/syscall.h>
31 # endif
32
33 # if !defined(HAVE_UNSHARE) && defined(SYS_unshare)
34 static inline int unshare(int flags)
35 {
36 return syscall(SYS_unshare, flags);
37 }
38 # endif
39
40 # if !defined(HAVE_SETNS) && defined(SYS_setns)
41 static inline int setns(int fd, int nstype)
42 {
43 return syscall(SYS_setns, fd, nstype);
44 }
45 # endif
46
47 #endif /* UTIL_LINUX_NAMESPACE_H */