#include //pid_t #include //fork() #include //waitpid #include //printf... #include //exit() //cntrl-proc1.c int main(void) { pid_t pid; int status; pid=fork(); if(pid!=0) { printf("pid1=%d\n",pid); wait(&status);printf("status1=%d\n",status); exit(0); }else{ pid=fork(); if(pid==0) exit(1); printf("\tpid=%d ppid=%d\n",pid,getpid()); wait(&status);printf("\tstatus=%d\n",status); pid=fork(); if(pid==0) exit(2); printf("\tpid2=%d\n",pid); wait(&status);printf("\tstatus2=%d\n",status); pid=fork(); if(pid==0) abort(); printf("\tpid3=%d\n",pid); wait(&status);printf("\tstatus3=%d\n",status); pid=fork(); if(pid==0) status /= 0; printf("\tpid4=%d\n",pid); wait(&status);printf("\tstatus4=%d\n",status); exit(0); } }