#include #include #include int main(){ pid_t pid = fork(); if(pid){ // We're the parent sleep(10); int exit_status; pid_t waited_pid = wait(&exit_status); printf("Waited on %d, exited with status %d\n", waited_pid, WEXITSTATUS(exit_status)); printf("Waited on %d, exited with status %d\n", waited_pid, (exit_status & 0xFF00) >> 8 ); } else { // We're the child return 13; } return 0; }