Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ wait3(2) — DG/UX 4.30

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

exit(2)

fork(2)

ptrace(2)

sigpause(2)

sigvec(2)

wait(2)

wait4(2)



     wait3(2)                   DG/UX 4.30                    wait3(2)



     NAME
          wait3 - Wait for child process to stop or terminate.

     SYNOPSIS
          #include <sys/wait.h>
          #include <sys/time.h>
          #include <sys/resource.h>

          int     wait3   (wait_status, options, rusage)
          union wait    * wait_status;
          int             options;
          struct rusage * rusage;

     PARAMETERS
          wait_status    NULL or address of a status word.

          options        Modifications to the action of wait3.

          rusage         NULL or address of a resource usage
                         structure.

     DESCRIPTION
          The wait3 system call suspends the calling process until a
          child process stops or terminates, then reports the
          identity, status, and resource usage of the child process to
          the calling process.  If more than one child process has
          stopped or terminated, the manner in which one is chosen is
          undefined.

          *    A process stops when it is being traced (see ptrace)
               and either hits a break point or receives a signal that
               is set to be caught.

          *    A process terminates when it calls exit or when it
               receives a signal that causes it to terminate.

          *    A process that has terminated but whose status has not
               been reported on by wait may consume system resources.
               The wait operation cleans up the terminated process and
               recovers remaining system resources.

          wait3 returns the PID of the child process.

          The status of the child process is optionally obtained by
          the wait_status parameter.  If wait_status is NULL, status
          information is not returned.  Otherwise, 16 bits of status
          information are stored in the low-order 16 bits of the
          location pointed to by wait_status.  wait_status can be used
          to determine the cause of termination See wait.

          A summary of the resources used by a child process that has
          terminated is obtained by the rusage parameter.  If rusage



     Licensed material--property of copyright holder(s)         Page 1





     wait3(2)                   DG/UX 4.30                    wait3(2)



          is NULL, a summary is not returned.  Otherwise, summary
          information is stored in the location pointed to by rusage.

          The following statement:

             wait(status)

          is identical to this one:

             wait3(status, 0, NULL)

          However, the action taken by wait3 may be modified by
          setting bits in the options parameter as follows.

          *    The WNOHANG bit specifies that the calling process
               should not be suspended by wait3.

          *    A process that is not being traced may be stopped by
               the SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signals. The
               WUNTRACED bit specifies that the status of all stopped
               child processes should be reported, not just those
               being traced.

          If a parent process terminates without waiting for its child
          processes to terminate, a special system process inherits
          the child processes.

          If an error occurs, wait3 will not clean-up any process and
          the values of status and rusage are undefined.

          wait3 is automatically restarted when a process receives a
          signal while awaiting the termination of a child process.

     ACCESS CONTROL
          None.

     RETURN VALUE
          child-process-id
                         Completed successfully.

          0              The WNOHANG bit in options was set, and the
                         calling process would otherwise have been
                         suspended by wait3.

          -1             An error occurred.  Errno is set to indicate
                         the error.

     EXCEPTIONS
          Errno may be set to one of the following error codes:

          ECHILD         The calling process has no child processes.
                         This condition implies that the calling



     Licensed material--property of copyright holder(s)         Page 2





     wait3(2)                   DG/UX 4.30                    wait3(2)



                         process was not suspended by wait3.

          EFAULT         The status or rusage arguments point to an
                         illegal address.  This condition implies that
                         the calling process was not suspended by
                         wait3.

     SEE ALSO
          exec(2), exit(2), fork(2), ptrace(2), sigpause(2),
          sigvec(2), wait(2), wait4(2).

     STANDARDS
          When using m88kbcs as the Software Development Environment
          target, the wait3 function will be an incomplete emulation
          of Berkeley semantics.  Since we are using BCS system calls,
          resource usage information is not available.  If rusage is
          non-NULL, wait3 will fail with errno set to EINVAL.






































     Licensed material--property of copyright holder(s)         Page 3



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