Waits for a child process to change state.
Standard C Library (libc.a)
#include <sys/wait.h>;
int waitid (idtype, id, infop, options)
idtype_t idtype;
id_t id;
siginfo_t *infop;
int options;
The waitid subroutine suspends the calling thread until one child of the process containing the calling thread changes state. It records the current state of a child in the structure pointed to by the infop parameter. If a child process changed state prior to the call to the waitid subroutine, the waitid subroutine returns immediately. If more than one thread is suspended in the wait or waitpid subroutines waiting for termination of the same process, exactly one thread will return the process status at the time of the target process termination.
Item | Description |
---|---|
idtype | Specifies the child process. |
id | Specifies the child process. |
infop | Specifies the location of a siginfo_t structure to be filled in with resource utilization information. |
options | Specifies which state changes the waitid subroutine
will wait for. It is formed by OR'ing together one or more of the
following flags:
|
If WNOHANG was specified and there are no children to wait for, 0 is returned. If the waitid subroutine returns due to the change of state of one of its children, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
Item | Description |
---|---|
ECHILD | The calling process has no existing unwaited-for child processes. |
EINTR | The waitid subroutine was interrupted by a signal. |
EINVAL | An invalid value was specified for the options, or idtype parameters and the id parameter specifies an invalid set of processes. |