Annotation of cci/usr/src/man/man2/wait.2, revision 1.1

1.1     ! root        1: .TH WAIT 2 "27 July 1983"
        !             2: .UC 4
        !             3: .SH NAME
        !             4: wait, wait3 \- wait for process to terminate
        !             5: .SH SYNOPSIS
        !             6: .ft B
        !             7: .nf
        !             8: #include <sys/wait.h>
        !             9: .PP
        !            10: .ft B
        !            11: pid = wait(status)
        !            12: int pid;
        !            13: union wait *status;
        !            14: .PP
        !            15: .ft B
        !            16: pid = wait(0)
        !            17: int pid;
        !            18: .PP
        !            19: .ft B
        !            20: #include <sys/time.h>
        !            21: #include <sys/resource.h>
        !            22: .PP
        !            23: .ft B
        !            24: pid = wait3(status, options, rusage)
        !            25: int pid;
        !            26: union wait *status;
        !            27: int options;
        !            28: struct rusage *rusage;
        !            29: .fi
        !            30: .SH DESCRIPTION
        !            31: .I Wait
        !            32: causes its caller to delay until a signal is received or
        !            33: one of its child
        !            34: processes terminates.
        !            35: If any child has died since the last
        !            36: .IR wait ,
        !            37: return is immediate, returning the process id and
        !            38: exit status of one of the terminated
        !            39: children.
        !            40: If there are no children, return is immediate with
        !            41: the value \-1 returned.
        !            42: .PP
        !            43: On return from a successful 
        !            44: .I wait
        !            45: call, 
        !            46: .I status
        !            47: is nonzero, and the high byte of 
        !            48: .I status
        !            49: contains the low byte of the argument to
        !            50: .I exit
        !            51: supplied by the child process;
        !            52: the low byte of 
        !            53: .I status
        !            54: contains the termination status of the process.
        !            55: A more precise definition of the
        !            56: .I status
        !            57: word is given in
        !            58: .RI < sys/wait.h >.
        !            59: .PP
        !            60: .I Wait3
        !            61: provides an alternate interface for programs
        !            62: which must not block when collecting the status
        !            63: of child processes.  The
        !            64: .I status
        !            65: parameter is defined as above.  The
        !            66: .I options
        !            67: parameter is used to indicate the call should not block if
        !            68: there are no processes which wish to report status (WNOHANG),
        !            69: and/or that only children of the current process which are stopped
        !            70: due to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal should have
        !            71: their status reported (WUNTRACED).  If
        !            72: .I rusage
        !            73: is non-zero, a summary of the resources used by the terminated
        !            74: process and all its
        !            75: children is returned (this information is currently not available
        !            76: for stopped processes).
        !            77: .PP
        !            78: When the WNOHANG option is specified and no processes
        !            79: wish to report status, 
        !            80: .I wait3
        !            81: returns a 
        !            82: .I pid
        !            83: of 0.  The WNOHANG and WUNTRACED options may be combined by 
        !            84: .IR or 'ing
        !            85: the two values.
        !            86: .SH NOTES
        !            87: See
        !            88: .IR sigvec (2)
        !            89: for a list of termination statuses (signals);
        !            90: 0 status indicates normal termination.
        !            91: A special status (0177) is returned for a stopped process
        !            92: which has not terminated and can be restarted;
        !            93: see
        !            94: .IR ptrace (2).
        !            95: If the 0200 bit of the termination status
        !            96: is set,
        !            97: a core image of the process was produced
        !            98: by the system.
        !            99: .PP
        !           100: If the parent process terminates without
        !           101: waiting on its children,
        !           102: the initialization process
        !           103: (process ID = 1)
        !           104: inherits the children.
        !           105: .PP
        !           106: .I Wait
        !           107: and
        !           108: .I wait3
        !           109: are automatically restarted when a process receives a
        !           110: signal while awaiting termination of a child process.
        !           111: .SH "RETURN VALUE
        !           112: If \fIwait\fP returns due to a stopped
        !           113: or terminated child process, the process ID of the child
        !           114: is returned to the calling process.  Otherwise, a value of \-1
        !           115: is returned and \fIerrno\fP is set to indicate the error.
        !           116: .PP
        !           117: .I Wait3
        !           118: returns \-1 if there are no children not previously waited
        !           119: for;  0 is returned if WNOHANG is specified and there are
        !           120: no stopped or exited children.
        !           121: .SH ERRORS
        !           122: .I Wait
        !           123: will fail and return immediately if one or more of the following
        !           124: are true:
        !           125: .TP 15
        !           126: [ECHILD]
        !           127: The calling process has no existing unwaited-for
        !           128: child processes.
        !           129: .TP 15
        !           130: [EFAULT]
        !           131: The \fIstatus\fP or \fIrusage\fP arguments point to an illegal address.
        !           132: .SH "SEE ALSO"
        !           133: exit(2)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.