Created
November 21, 2013 13:54
-
-
Save yodalee/7581914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
int main(int argc, const char *argv[]) | |
{ | |
int i; | |
pid_t pid; | |
if (argc != 2) { | |
fprintf(stderr, "Usage: zombie num\n"); | |
exit(1); | |
} | |
if ((pid = fork()) == 0) { | |
for (i = 0; i < atoi(argv[1]); ++i) { | |
if (fork() == 0) { | |
exit(0); | |
} | |
} | |
while(1); | |
} else { | |
printf("kill zombie by pid = %d XDDD\n", pid); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment