Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ wait3(SLIB) — OpenDesktop Software Development System 3.0.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exit(S)

times(S)

wait(S)


 wait3(SLIB)                    6 January 1993                    wait3(SLIB)


 Name

    wait3 - wait for process to terminate or stop

 Syntax


    #define __SCO_WAIT3__
    #include  <sys/wait.h>
    #include  <sys/time.h>
    #include  <sys/resource.h>

    pid = wait3(status, options, rusage)
    int pid;
    union wait *status;
    int options;
    struct rusage *rusage;


 Description

    wait3 is an alternate interface to wait(S) that allows non-blocking
    status collection.  With a zero-valued options parameter, wait3 functions
    similarly to wait(S).  Setting the options parameter to WNOHANG indicates
    that the call should not block if there are no processes that have status
    to report.  A terminated child is discarded after it reports status.  If
    rusage is non-zero, a summary of the resources used by the terminated
    process and all its children is returned.  Currently, only the ruutime
    and rustime fields of the rusage structure are filled in.

    If the WNOHANG option is specified and no processes have status to
    report, wait3 returns a pid of 0.

    To use the wait3 system call, you must compile with the -DSCOWAIT3
    flag, or include that flag in your source file. An example from the com-
    mand line would be:

       cc -D__SCO_WAIT3__ file.c

    An example in a file would be:

       #define __SCO_WAIT3__
       #include <sys/wait.h>

    The define statement must appear before the include statement.


 Notes

    A precise definition of the status parameter is given in <sys/wait.h>.
    See signal(S) for a list of termination statuses (signals); zero status
    indicates normal termination.  status.w_stopval is set to WSTOPPED (0177)
    if a process has not terminated and can be restarted; see ptrace(S).  If
    the wcoredump field of the termination status is non-zero, a core image
    of the process was produced by the system.

    If the parent process terminates without waiting for its children, the
    initialization process (process ID = 1) inherits the children.

 Return value

    If there are no children not previously waited for, wait3 returns -1; if
    WNOHANG is specified and there are no stopped or exited children, zero is
    returned.  Otherwise, the process id of the reaped child is returned.

 Errors

    wait3 will fail and return -1 immediately if the following is true:

    [ECHILD]  The calling process has no existing unwaited-for child pro-
              cesses.

    [EINTR]   WNOHANG was not set and wait3 was interrupted due to receipt of
              a signal.

 See also

    exit(S), times(S) and wait(S).


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026