DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

waitid(S-osr5)


waitid -- wait for child process to change state

Syntax

cc . . . -lc
#include <sys/types.h>
#include <wait.h>

int waitid(idtype_t idtype, id_t id, siginfo_t *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 siginfo_t structure 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.

The options argument is used to specify which state changes waitid is to wait for. It is formed by an 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(S-osr5)).

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.

WNOWAIT
Keep the process in a waitable state. This will not affect the state of the process on subsequent waits.
infop must point to a siginfo_t structure, as defined in siginfo(FP). siginfo_t is filled in by the system with the status of the process being waited for.

Return values

If waitid returns due to a change of state of one of its children, it returns 0. Otherwise, waitid returns -1 and sets errno to identify the error.

Diagnostics

In the following conditions, waitid fails and sets errno to:

[EFAULT]
infop points to an invalid address.

[EINTR]
waitid was interrupted due to the receipt of a signal by the calling process.

[EINVAL]
No options were specified or 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.

Files


/lib/libc.a
linking library

See also

exec(S-osr5), exit(S-osr5), fork(S-osr5), Intro(S-osr5), pause(S-osr5), ptrace(S-osr5), sigaction(S-osr5), siginfo(FP), sigaction(S-osr5), signal(M), signal(S-osr5), wait(S-osr5), waitpid(S-osr5)

Standards conformance

waitid is conformant with:

AT&T SVID Issue 3.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005