|
|
1.1 root 1: .TH EXIT 2
2: .CT 2 time_man proc_man
3: .SH NAME
4: _exit, wait wait3 \(mi terminate process, wait for child to terminate
5: .SH SYNOPSIS
6: .nf
7: .B void _exit(status)
8: .B int status;
9: .PP
10: .B int wait(status)
11: .B int *status;
12: .PP
13: .B int wait((int *)0)
14: .PP
15: .B #include <sys/vtimes.h>
16: .PP
17: .B wait3(status, options, ch_vt)
18: .B int *status;
19: .B struct vtimes *ch_vt;
20: .fi
21: .SH DESCRIPTION
22: .I _exit
23: closes all the process's files and notifies the parent process
24: when the parent executes
25: .IR wait .
26: The low-order 8 bits of
27: .I status
28: are available to the parent process.
29: The call never returns.
30: .PP
31: The function
32: .IR exit (3),
33: which is the normal means of terminating a process,
34: may cause cleanup actions before finally calling
35: .IR _exit .
36: Therefore,
37: .I _exit
38: should be called to terminate a child
39: process after a
40: .IR fork (2)
41: to avoid flushing buffered output twice.
42: .PP
43: .I Wait
44: delays until a signal is received or until
45: a child processes terminates or receives signal
46: .BR SIGSTOP .
47: There is no delay if any child has died since the last
48: .I wait,
49: or if there are no extant children.
50: The normal return yields the process id
51: and status of one terminated child.
52: The status of other children
53: may be learned from further
54: .I wait
55: calls.
56: .PP
57: If
58: .I status
59: is nonzero,
60: .I wait
61: sets
62: .IR \f5*\fPstatus " = (" s <<8)+ t
63: where
64: .I s
65: is the low 8 bits
66: of
67: .I status
68: from the child's
69: .IR exit ,
70: if any,
71: and
72: .I t
73: is the termination status of the child.
74: See
75: .IR signal (2)
76: for a list of termination statuses (signals);
77: status 0 indicates normal termination, 0177
78: a (restartable) process stopped on
79: .BR SIGSTOP .
80: If the 0200
81: bit of the termination status
82: is set,
83: a core image of the process was produced
84: by the system.
85: .PP
86: .I Wait3
87: is similar to
88: .I wait.
89: An
90: .I option
91: value of 1 prevents waiting for extant, non-stopped children
92: and causes 0 to be returned if children exist but none have
93: reportable status.
94: If
95: .I ch_vt
96: is nonzero, resource usage data for the child are reported
97: as by
98: .IR vtimes (2).
99: .PP
100: If the parent process terminates without
101: waiting on its children,
102: they are inherited by
103: process 1
104: (the initialization process,
105: .IR init (8)).
106: .SH "SEE ALSO"
107: .IR fork (2),
108: .IR exit (3),
109: .IR signal (2),
110: .IR sh (1)
111: .SH DIAGNOSTICS
112: .IR wait ,
113: .IR wait3 :
114: .B ECHILD
115: .SH BUGS
116: If the argument to
117: .I wait
118: is bogus, the user program gets a memory fault rather than an
119: .BR EFAULT .
120: .br
121: The 0 third argument to
122: .I wait3
123: is a required historical dreg.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.