| Elliott Hughes | 5dec78d | 2014-02-26 15:56:23 -0800 | [diff] [blame] | 1 | /* for CLONE_foo: */ |
| 2 | #define _GNU_SOURCE 1 | ||||
| 3 | |||||
| 4 | #include <stdio.h> | ||||
| 5 | #include <stdlib.h> | ||||
| 6 | #include <sched.h> | ||||
| 7 | #include <unistd.h> | ||||
| 8 | |||||
| 9 | int child(void* arg) | ||||
| 10 | { | ||||
| 11 | write(1, "clone\n", 6); | ||||
| 12 | return 0; | ||||
| 13 | } | ||||
| 14 | |||||
| 15 | int main(int argc, char *argv[]) | ||||
| 16 | { | ||||
| 17 | char stack[4096]; | ||||
| 18 | clone(child, stack+4000, CLONE_VM|CLONE_FS|CLONE_FILES, NULL); | ||||
| 19 | write(1, "original\n", 9); | ||||
| 20 | exit(0); | ||||
| 21 | } | ||||