Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

wait3, wait364 - wait for status change of child processes

&pagelevel(4)&pagelevel

Syntax

#include <sys/wait.h>

pid_t wait3(int *stat_loc, int options, struct rusage *resource_usage); 

CRTE111A30

pid_t wait364(int *stat_loc, int options, struct rusage64 *resource_usage);  (End)

Description

wait3() returns status information on the specified child process to the calling process.
The call

wait3(stat_loc, options, resource_usage);

is equivalent to the call

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

except that on successful execution in the specified rusage structure resource_usage, the status information for the child process identified by the return value is entered.

wait3() is not thread-safe.

If threads are used, the wait() and waitpid() functions affect the process or a thread in the following manner: wait3() returns status information on the specified child process to the calling thread.

The function wait364() behaves like the function wait3(), except that the argument r_usage points to a structure rusage instead of a structure rusage.

The structure rusage contains the following components:

struct timeval ru_utime    /* The total time the execution takes in user mode.
                              The interval is specified in seconds and 
                              microseconds. */
struct timeval ru_stime    /* The total time the execution takes in system
                              mode. The interval is specified in seconds and
                              microseconds. */

The structure rusage64 contains the following components:

struct timeval64 ru_utime    /* The total time the execution takes in user mode.
                                The interval is specified in seconds and 
                                microseconds. */
struct timeval64 ru_stime    /* The total time the execution takes in system
                                mode. The interval is specified in seconds and
                                microseconds. */ 

Return val.

see waitpid().

In addition to the errors specified for waitpid(), wait3() will fail if:

Errors

see waitpid().

In addition to the errors specified for waitpid(), wait3() and wait364() will fail if:


ECHILD

For the calling process there are no child processes which are not waited for, or
the group of processes specified by the pid argument can never acquire the status specified by options.


In addition to the errors specified for waitpid(), wait364() will fail if:

 

ENOSYS

POSIX-BC correction status < A47.

Notes

If a parent process is terminated without waiting for its child processes, the initialization process (process ID = 1) takes over the child processes.

See also

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