如何产生10个僵尸进程
#include<stdio.h>#include<stdlib.h>
#include<unistd.h>
#include<string.h>
int main(void)
{
pid_t child;
int i;
for(i = 0;i < 10;i++)
{
child = fork();
if(child > 0)
{
// wait(NULL);
while(1)
{
setsid();
printf("this is comzes=[%d]\n",getppid());
sleep(1);
}
}else if(child == 0)
{
printf("this is child=[%d]\n",getpid());
exit(-1);
}
}
return 0;
}
求指教。。