waitid(2) waitid(2)
NAME
waitid - wait for child process to change state
SYNOPSIS
#include <sys/types.h>
#include <wait.h>
int waitid(idtypet idtype, idt id, siginfot *infop, int options);
DESCRIPTION
waitid() suspends the calling process until one of its children
changes state. It records the current state of a child in the struc-
ture pointed to by infop If a child process changed state prior to the
call to waitid(), waitid() returns immediately.
The idtype and id arguments specify which children waitid() is to wait
for.
- If idtype is PPID, waitid() waits for the child with a process ID
equal to (pidt)id.
- If idtype is PPGID, waitid() waits for any child with a process
group ID equal to (pidt)id.
- If idtype is PALL, waitid() waits for any children and id is
ignored.
The options argument is used to specify which state changes waitid()
is to wait for. It is formed by a bitwise OR of any of the following
flags:
WEXITED Wait for process(es) to exit.
WTRAPPED Wait for traced process(es) to become trapped or reach a
breakpoint [see ptrace(2)].
WSTOPPED Wait for and return the process status of any child that
has stopped upon receipt of a signal.
WCONTINUED Return the status for any child that was stopped and has
been continued.
WNOHANG Return immediately if there are no children to wait for.
WNOWAIT Keep the process whose status is returned in infop in a
waitable state. This will not affect the state of the pro-
cess; the process may be waited for again after this call
completes.
infop must point to a siginfot structure, as defined in siginfo(5).
siginfot is filled in by the system with the status of the process
being waited for.
Page 1 Reliant UNIX 5.44 Printed 11/98
waitid(2) waitid(2)
ERRORS
The following error code descriptions are function-specific. You will
find a general description in introprm2(2) or in errno(5).
waitid() fails if one or more of the following are true.
EFAULT infop points to an invalid address.
EINTR waitid() was interrupted due to the receipt of a signal by
the calling process.
EINVAL An invalid value was specified for options.
EINVAL idtype and id specify an invalid set of processes.
ECHILD The set of processes specified by idtype and id does not
contain any unwaited-for processes.
RESULT
If waitid() returns due to a change of state of one of its children, a
value of 0 is returned. Otherwise, a value of -1 is returned and errno
is set to indicate the error.
SEE ALSO
exec(2), exit(2), fork(2), pause(2), ptrace(2), signal(2),
sigaction(2), wait(2), siginfo(5), types(5), wait(5).
Page 2 Reliant UNIX 5.44 Printed 11/98