#include #include #include int main(){ puts("We're about to call fork"); pid_t return_value = fork(); printf("We just called fork, and the return value was %d\n", return_value); if(return_value){ printf("We're the parent, let's take a nap\n"); pid_t dead_child_pid = wait(0); // printf("Child with pid %d has died, we will now take a nap\n", dead_child_pid); // sleep(80); // printf("Finished nap\n"); } else { printf("We're the child\n"); execlp("ls", 0); puts("***** This should not print out"); } puts("This will happen only once because the child executed ls instead!"); return 0; }