]>
Commit | Line | Data |
---|---|---|
1130df60 | 1 | .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) |
c11b1abf | 2 | .\" and Copyright (c) 2004 by Michael Kerrisk (mtk.manpages@gmail.com) |
fea681da | 3 | .\" |
4b72fb64 | 4 | .\" %%%LICENSE_START(verbatim) |
fea681da MK |
5 | .\" Permission is granted to make and distribute verbatim copies of this |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
c13182ef | 13 | .\" |
fea681da MK |
14 | .\" Since the Linux kernel and libraries are constantly changing, this |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
c13182ef | 21 | .\" |
fea681da MK |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 24 | .\" %%%LICENSE_END |
fea681da MK |
25 | .\" |
26 | .\" Modified Sat Jul 24 13:32:44 1993 by Rik Faith (faith@cs.unc.edu) | |
27 | .\" Modified Mon Jun 23 14:09:52 1997 by aeb - add EINTR. | |
28 | .\" Modified Tue Jul 7 12:26:42 1998 by aeb - changed return value wait3 | |
c11b1abf | 29 | .\" Modified 2004-11-11, Michael Kerrisk <mtk.manpages@gmail.com> |
c13182ef | 30 | .\" Rewrote much of this page, and removed much duplicated text, |
fe4992a7 | 31 | .\" replacing with pointers to wait.2 |
fea681da | 32 | .\" |
85d301e1 | 33 | .TH WAIT4 2 2012-09-23 "Linux" "Linux Programmer's Manual" |
fea681da | 34 | .SH NAME |
fe4992a7 | 35 | wait3, wait4 \- wait for process to change state, BSD style |
fea681da MK |
36 | .SH SYNOPSIS |
37 | .nf | |
38 | .B #include <sys/types.h> | |
39 | .B #include <sys/time.h> | |
40 | .B #include <sys/resource.h> | |
41 | .B #include <sys/wait.h> | |
fe4992a7 | 42 | .sp |
fea681da | 43 | .BI "pid_t wait3(int *" "status" ", int " options , |
521bf584 | 44 | .BI " struct rusage *" rusage ); |
fea681da MK |
45 | .sp |
46 | .BI "pid_t wait4(pid_t " pid ", int *" status ", int " options , | |
521bf584 | 47 | .BI " struct rusage *" rusage ); |
fea681da | 48 | .fi |
cc4615cc MK |
49 | .sp |
50 | .in -4n | |
51 | Feature Test Macro Requirements for glibc (see | |
52 | .BR feature_test_macros (7)): | |
53 | .in | |
54 | .sp | |
947c9189 | 55 | .ad l |
cc4615cc | 56 | .BR wait3 (): |
947c9189 MK |
57 | .RS 4 |
58 | _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || | |
59 | _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED | |
60 | .RE | |
cc4615cc MK |
61 | .br |
62 | .BR wait4 (): | |
947c9189 MK |
63 | .RS 4 |
64 | _BSD_SOURCE | |
65 | .RE | |
66 | .ad | |
fea681da | 67 | .SH DESCRIPTION |
85d301e1 AB |
68 | These functions are obsolete; use |
69 | .BR waitpid (2) | |
70 | or | |
71 | .BR waitid (2) | |
72 | in new programs. | |
73 | ||
fea681da | 74 | The |
fe4992a7 MK |
75 | .BR wait3 () |
76 | and | |
77 | .BR wait4 () | |
78 | system calls are similar to | |
79 | .BR waitpid (2), | |
80 | but additionally return resource usage information about the | |
81 | child in the structure pointed to by | |
82 | .IR rusage . | |
83 | .PP | |
84 | Other than the use of the | |
85 | .I rusage | |
86 | argument, the following | |
87 | .BR wait3 () | |
88 | call: | |
89 | .nf | |
fea681da | 90 | |
fe4992a7 | 91 | wait3(status, options, rusage); |
fea681da | 92 | |
fe4992a7 MK |
93 | .fi |
94 | is equivalent to: | |
95 | .nf | |
96 | ||
2bc2f479 | 97 | waitpid(\-1, status, options); |
fe4992a7 MK |
98 | |
99 | .fi | |
100 | Similarly, the following | |
101 | .BR wait4 () | |
102 | call: | |
103 | .nf | |
104 | ||
105 | wait4(pid, status, options, rusage); | |
106 | ||
107 | .fi | |
108 | is equivalent to: | |
109 | .nf | |
110 | ||
111 | waitpid(pid, status, options); | |
112 | ||
113 | .fi | |
114 | In other words, | |
115 | .BR wait3 () | |
116 | waits of any child, while | |
117 | .BR wait4 () | |
118 | can be used to select a specific child, or children, on which to wait. | |
119 | See | |
120 | .BR wait (2) | |
121 | for further details. | |
fea681da MK |
122 | .PP |
123 | If | |
124 | .I rusage | |
8478ee02 | 125 | is not NULL, the |
fe4992a7 MK |
126 | .I struct rusage |
127 | to which it points will be filled with accounting information | |
128 | about the child. | |
129 | See | |
fea681da MK |
130 | .BR getrusage (2) |
131 | for details. | |
47297adb | 132 | .SH RETURN VALUE |
fe4992a7 | 133 | As for |
540036b2 | 134 | .BR waitpid (2). |
fea681da | 135 | .SH ERRORS |
fe4992a7 | 136 | As for |
540036b2 | 137 | .BR waitpid (2). |
47297adb | 138 | .SH CONFORMING TO |
44a2c328 | 139 | 4.3BSD. |
0ac42204 MK |
140 | |
141 | SUSv1 included a specification of | |
142 | .BR wait3 (); | |
143 | SUSv2 included | |
144 | .BR wait3 (), | |
145 | but marked it LEGACY; | |
146 | SUSv3 removed it. | |
fea681da MK |
147 | .SH NOTES |
148 | Including | |
149 | .I <sys/time.h> | |
150 | is not required these days, but increases portability. | |
151 | (Indeed, | |
152 | .I <sys/resource.h> | |
153 | defines the | |
154 | .I rusage | |
155 | structure with fields of type | |
156 | .I struct timeval | |
157 | defined in | |
158 | .IR <sys/time.h> .) | |
e0d16ae5 MK |
159 | |
160 | On Linux, | |
161 | .BR wait3 () | |
162 | is a library function implemented on top of the | |
163 | .BR wait4 () | |
164 | system call. | |
47297adb | 165 | .SH SEE ALSO |
fe4992a7 | 166 | .BR fork (2), |
fea681da | 167 | .BR getrusage (2), |
fe4992a7 | 168 | .BR sigaction (2), |
fea681da MK |
169 | .BR signal (2), |
170 | .BR wait (2), | |
171 | .BR signal (7) |