pid_t waitpid(pid_t pid, int *status, int option)
If option is 0,
- If pid is -1, wait for any child process to terminate
- If pid > 0 wait for a specific child to terminate
- The integer pointed to by status will be filled with bits indicating how the process terminated and the exit value if the process terminated normally.
It is also possible to wait for a child that has stopped by setting option to the appropriate value.
If no unwaited for children exist, waitpid returns -1 without waiting.