Skip to content

Instantly share code, notes, and snippets.

@yodalee
Created November 21, 2013 13:54
Embed
What would you like to do?
#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