Denys Vlasenko | 8158e77 | 2011-06-08 14:08:59 +0200 | [diff] [blame] | 1 | /* for CLONE_foo: */ |
2 | #define _GNU_SOURCE 1 | ||||
3 | |||||
Wichert Akkerman | 529f06d | 2000-04-10 22:26:39 +0000 | [diff] [blame] | 4 | #include <stdio.h> |
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 5 | #include <stdlib.h> |
Wichert Akkerman | 529f06d | 2000-04-10 22:26:39 +0000 | [diff] [blame] | 6 | #include <sched.h> |
Mike Frysinger | b51ce62 | 2013-05-02 15:43:45 -0400 | [diff] [blame] | 7 | #include <unistd.h> |
Wichert Akkerman | 529f06d | 2000-04-10 22:26:39 +0000 | [diff] [blame] | 8 | |
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 9 | int child(void* arg) |
10 | { | ||||
11 | write(1, "clone\n", 6); | ||||
12 | return 0; | ||||
Wichert Akkerman | 529f06d | 2000-04-10 22:26:39 +0000 | [diff] [blame] | 13 | } |
14 | |||||
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 15 | int main(int argc, char *argv[]) |
Wichert Akkerman | 529f06d | 2000-04-10 22:26:39 +0000 | [diff] [blame] | 16 | { |
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 17 | char stack[4096]; |
Wichert Akkerman | 9b0c31d | 2000-09-03 21:56:29 +0000 | [diff] [blame] | 18 | clone(child, stack+4000, CLONE_VM|CLONE_FS|CLONE_FILES, NULL); |
19 | write(1, "original\n", 9); | ||||
Wichert Akkerman | 529f06d | 2000-04-10 22:26:39 +0000 | [diff] [blame] | 20 | exit(0); |
21 | } |