int forkprocess(void)
{
printf("forkprocess running......\r\n");
pid_t pid = 0;
int status;
while(1)
{
pid = fork();
if(pid < 0)
{
printf("fork error............\r\n");
exit(1);
}
if(pid == 0)
{
printf("this is child prodess return............\r\n");
return 0;
}
printf("wait child prodess........\n");
waitpid(pid, &status, 0);
printf("child prodess end........\n");
}
return 0;
}
{
printf("forkprocess running......\r\n");
pid_t pid = 0;
int status;
while(1)
{
pid = fork();
if(pid < 0)
{
printf("fork error............\r\n");
exit(1);
}
if(pid == 0)
{
printf("this is child prodess return............\r\n");
return 0;
}
printf("wait child prodess........\n");
waitpid(pid, &status, 0);
printf("child prodess end........\n");
}
return 0;
}