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> |
7 | |||||
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 8 | int child(void* arg) |
9 | { | ||||
10 | write(1, "clone\n", 6); | ||||
11 | return 0; | ||||
Wichert Akkerman | 529f06d | 2000-04-10 22:26:39 +0000 | [diff] [blame] | 12 | } |
13 | |||||
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 14 | int main(int argc, char *argv[]) |
Wichert Akkerman | 529f06d | 2000-04-10 22:26:39 +0000 | [diff] [blame] | 15 | { |
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 16 | char stack[4096]; |
Wichert Akkerman | 9b0c31d | 2000-09-03 21:56:29 +0000 | [diff] [blame] | 17 | clone(child, stack+4000, CLONE_VM|CLONE_FS|CLONE_FILES, NULL); |
18 | write(1, "original\n", 9); | ||||
Wichert Akkerman | 529f06d | 2000-04-10 22:26:39 +0000 | [diff] [blame] | 19 | exit(0); |
20 | } |