Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 1 | #include <stdlib.h> |
2 | #include <unistd.h> | ||||
Mike Frysinger | b51ce62 | 2013-05-02 15:43:45 -0400 | [diff] [blame] | 3 | #include <sys/wait.h> |
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 4 | |
5 | int main(int argc, char *argv[]) | ||||
Wichert Akkerman | faf7222 | 2000-02-19 23:59:03 +0000 | [diff] [blame] | 6 | { |
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 7 | if (vfork() == 0) { |
Wichert Akkerman | faf7222 | 2000-02-19 23:59:03 +0000 | [diff] [blame] | 8 | write(1, "child\n", 6); |
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 9 | } else { |
Wichert Akkerman | faf7222 | 2000-02-19 23:59:03 +0000 | [diff] [blame] | 10 | wait(0); |
11 | write(1, "parent\n", 7); | ||||
12 | } | ||||
Denys Vlasenko | 8ed5727 | 2009-02-25 14:24:02 +0000 | [diff] [blame] | 13 | |
Wichert Akkerman | faf7222 | 2000-02-19 23:59:03 +0000 | [diff] [blame] | 14 | exit(0); |
15 | } |