res = wait(&status); /* This syscall can block */ if (res < 0) { /* No children to wait for */ perror("Wait failed"); exit(-1); } /* Now the value returned from the child is in status */ ...