runsvinit/zombietest/build/zombie.c

19 lines
422 B
C
Raw Permalink Normal View History

2015-09-28 10:25:44 +00:00
#include <stdlib.h>
2015-09-28 20:30:44 +00:00
#include <stdio.h>
2015-09-28 10:25:44 +00:00
#include <unistd.h>
2015-09-28 20:30:44 +00:00
int main() {
pid_t pid;
int i;
for (i = 0; i<5; i++) {
pid = fork();
if (pid > 0) {
printf("Zombie #%d born\n", i + 1);
} else {
printf("Brains...\n");
exit(0);
}
}
return 0;
2015-09-28 10:25:44 +00:00
}