![]() |
![]() |
![]() |
![]() |
Wait for a child process to change state
#include <sys/wait.h> int waitid( idtype_t idtype, id_t id, siginfo_t * infop, int options );
libc
The waitid() function suspends the calling process until one of its children changes state. It records the current state of a child in the structure pointed to by infop. If a child process changed state prior to the call to waitid(), waitid() returns immediately.
The idtype indicates which children waitid() is to wait for:
The options argument is used to specify which state changes waitid() is to wait for, and is any combination of:
The infop argument must point to a siginfo_t structure, as defined in <sys/siginfo.h>. If waitid() returns because a child process was found that satisfied the conditions indicated by the arguments idtype and options, then the structure pointed to by infop is filled in by the system with the status of the process. The si_signo member is always SIGCHLD.
If idtype is P_ALL and options is WEXITED|WTRAPPED, waitid() is equivalent to wait().
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), exit(), fork(), pause(), sigaction(), signal(), wait(), wait3(), wait4(), waitpid()
![]() |
![]() |
![]() |
![]() |