HPlogo HP-UX Reference Volume 3 of 5 > w

wait3(2)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

wait3 — wait for child process to change state

SYNOPSIS

#include <sys/wait.h> pid_t wait3 (int *stat_loc, int options, struct rusage *resource_usage);

DESCRIPTION

The wait3() function allows the calling process to obtain status information for specified child processes.

The following call:

wait3(stat_loc, options, resource_usage);

is equivalent to the call:

waitpid((pid_t)-1, stat_loc, options);

except that on successful completion, if the resource_usage argument to wait3() is not a null pointer, the rusage structure that the third argument points to is filled in for the child process identified by the return value.

RETURN VALUE

See wait(2).

ERRORS

In addition to the error conditions specified on waitpid(), under the following conditions, wait3() may fail and set errno to:

[ECHILD]

The calling process has no existing unwaited-for child processes, or if the set of processes specified by the argument pid can never be in the states specified by the argument options.

APPLICATION USAGE

Threads Considerations

In a multi-threaded application, only the calling thread is suspended by wait3().

wait3() will not return until all threads in the process have reached the desired state. For example, wait3() will not return until all threads have terminated. If the WUNTRACED or WCONTINUED options are specified, wait3() will not return until all threads have stopped or continued respectively.

SEE ALSO

exec(2), exit(2), fork(2), pause(2), <sys/wait.h>.

CHANGE HISTORY

First released in Issue 4, Version 2.

wait3 HP-UX EXTENSIONS

SYNOPSIS (HP-UX)

pid_t wait3(int *stat_loc, int options, int *reserved);

DESCRIPTION

The wait3() system call is equivalent to waitpid() with the value of pid equal to zero. The third parameter to wait3(), reserved, is currently unused and must always be a null pointer.

ERRORS

If wait3() fails, errno is set to one of the following values.

[EINVAL]

The options argument to waitpid() or wait3() is invalid.

[EINVAL]

wait3() was passed a nonnull pointer value for its third argument.

WARNINGS

The behavior of wait3() is affected if the SIGCLD signal is set to SIG_IGN. See the WARNINGS section of signal(5). Signal handlers that cause system calls to be restarted can affect the EINTR condition described above (see bsdproc(3C), sigaction(2), and sigvector(2)).

AUTHOR

wait3() was developed by HP, AT&T, and the University of California, Berkeley.

SEE ALSO

Exit conditions ($?) in sh(1); exec(2), exit(2), fork(2), pause(2), ptrace(2), signal(5).

© Hewlett-Packard Development Company, L.P.