WUNTRACED
WUNTRACED is a flag used with POSIX wait-related system calls, notably waitpid and waitid. It requests that the call also report on children that have stopped due to a signal, in addition to those that have terminated. The flag is defined in the system header sys/wait.h and is combined with other options by using a bitwise OR when calling waitpid or waitid.
When WUNTRACED is set, a waitpid or waitid call will return for a child that has stopped
- pid_t p = waitpid(-1, &status, WUNTRACED);
- if (WIFSTOPPED(status)) { int sig = WSTOPSIG(status); /* handle stop */ }
- WUNTRACED is part of the POSIX wait family of options and is commonly available on Unix-like systems,
- It is used by debuggers, shells, and other tools that need visibility into not only terminated
In summary, WUNTRACED extends the information returned by waitpid and waitid to include stopped child processes,