#include #include #include #include int main(){ int pid = fork(); if (pid == -1) { exit(0); } if (pid == 0) { printf("fork = %d, pid = %d, ppid = %d\n",pid,getpid(),getppid()); sleep(4); exit(2); } if (pid > 0) { printf("fork = %d, pid = %d, ppid = %d\n",pid,getpid(),getppid()); printf("%d\n",wait()); exit(2); } }