Syntax of waitpid()
:
pid_t waitpid(pid_t pid, int *status, int options);
The value of pid
can be:
- < -1: Wait for any child process whose process group ID is equal to the absolute value of
pid
. - -1: Wait for any child process.
- 0: Wait for any child process whose process group ID is equal to that of the calling process.
- > 0: Wait for the child whose process ID is equal to the value of
pid
.
The value of options is an OR of zero or more of the following constants:
WNOHANG
: Return immediately if no child has exited.WUNTRACED
: Also return if a child has stopped. Status for traced children which have stopped is provided even if this option is not specified.WCONTINUED
: Also return if a stopped child has been resumed by delivery ofSIGCONT
.
For more help, use man waitpid
.