1 /* Check that clone() is implemented and properly works
10 #include <sys/ptrace.h>
16 clone_child (void *arg)
19 ptrace (PTRACE_TRACEME, 0, 0, 0);
22 if (kill (getpid (), SIGSTOP) < 0)
27 #define PAGE_SIZE 4096
28 #define STACK_SIZE (4 * PAGE_SIZE)
30 char clone_stack[STACK_SIZE] __attribute__ ((aligned (PAGE_SIZE)));
38 pid = clone (clone_child, clone_stack + 3 * PAGE_SIZE,
39 CLONE_VM | SIGCHLD, NULL);
45 printf ("child pid %d\n", pid);
48 child = waitpid (pid, &status, 0);
49 printf("waitpid returned %d\n", child);
54 printf ("child %d, status 0x%x\n", child, status);