Skip to content

Instantly share code, notes, and snippets.

@yodalee
Created November 21, 2013 13:54
Show Gist options
  • Save yodalee/7581914 to your computer and use it in GitHub Desktop.
Save yodalee/7581914 to your computer and use it in GitHub Desktop.
#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