#include #include // fork, sleep #include // exit #include // wait int main(){ int status; int pid; if ((pid = fork()) == 0) { printf("I'm the son and going to sleep for 30s.\n"); sleep(30); exit(3); } else if (pid == -1) { printf("fork() failed"); exit(2); } wait(&status); printf("wait status 0x%x | 0x%x | 0x%x\n", status, (status>>8) & 0xff, status & 0xff); return 0; }