United States-English |
|
|
HP-UX Reference > Wwaitid(2)HP-UX 11i Version 3: February 2007 |
|
NAMEwaitid — wait for child process to change state DESCRIPTIONThe 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 and id arguments are used to specify which children waitid() will wait for. If idtype is P_PID, waitid() will wait for the child with a process ID equal to (pid_t)pid. If idtypeis P_PGID, waitid() will wait for any child with a process group ID equal to (pid_t)pid. If idtypeis P_ALL, waitid() will wait for any children and id is ignored. The options argument is used to specify which state changes waitid() will wait for. It is formed by OR-ing together one or more of the following flags:
The infop argument must point to a siginfo_t structure. 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 will be filled in by the system with the status of the process. The si_signo member will always be equal to SIGCHLD. RETURN VALUEIf waitid() 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. ERRORSThe waitid() function will fail if:
APPLICATION USAGEThreads ConsiderationsIn a multi-threaded application, only the calling thread is suspended by waitid(). waitid() will not return until all threads in the process have reached the desired state. For example, if the WEXITED, WSTOPPED or WCONTINUED options are specified, waitid() will not return until all threads in the process have terminated, stopped or continued respectively. |
Printable version | ||
|