1 # Linux PID Namespace Support
3 The [LinuxSUIDSandbox](linux_suid_sandbox.md) currently relies on support for
4 the `CLONE_NEWPID` flag in Linux's
5 [clone() system call](http://www.kernel.org/doc/man-pages/online/pages/man2/clone.2.html).
6 You can check whether your system supports PID namespaces with the code below,
7 which must be run as root:
16 #if !defined(CLONE_NEWPID)
17 #define CLONE_NEWPID 0x20000000
20 int worker(void* arg) {
21 const pid_t pid = getpid();
23 printf("PID namespaces are working\n");
25 printf("PID namespaces ARE NOT working. Child pid: %d\n", pid);
33 fprintf(stderr, "Must be run as root.\n");
38 const pid_t child = clone(worker, stack + sizeof(stack), CLONE_NEWPID, NULL);
41 fprintf(stderr, "Clone failed. PID namespaces ARE NOT supported\n");
44 waitpid(child, NULL, 0);