1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\" and Copyright (c) 2004 by Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" Modified Sat Jul 24 13:32:44 1993 by Rik Faith (faith@cs.unc.edu)
7 .\" Modified Mon Jun 23 14:09:52 1997 by aeb - add EINTR.
8 .\" Modified Tue Jul 7 12:26:42 1998 by aeb - changed return value wait3
9 .\" Modified 2004-11-11, Michael Kerrisk <mtk.manpages@gmail.com>
10 .\" Rewrote much of this page, and removed much duplicated text,
11 .\" replacing with pointers to wait.2
13 .TH wait4 2 (date) "Linux man-pages (unreleased)"
15 wait3, wait4 \- wait for process to change state, BSD style
18 .RI ( libc ", " \-lc )
21 .B #include <sys/wait.h>
23 .BI "pid_t wait3(int *" "wstatus" ", int " options ", struct rusage *" rusage );
24 .BI "pid_t wait4(pid_t " pid ", int *" wstatus ", int " options ,
25 .BI " struct rusage *" rusage );
29 Feature Test Macro Requirements for glibc (see
30 .BR feature_test_macros (7)):
37 || (_XOPEN_SOURCE >= 500 &&
38 ! (_POSIX_C_SOURCE >= 200112L
39 || _XOPEN_SOURCE >= 600))
40 From glibc 2.19 to 2.25:
41 _DEFAULT_SOURCE || _XOPEN_SOURCE >= 500
42 Glibc 2.19 and earlier:
43 _BSD_SOURCE || _XOPEN_SOURCE >= 500
44 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
51 Glibc 2.19 and earlier:
55 These functions are nonstandard; in new programs, the use of
65 system calls are similar to
67 but additionally return resource usage information about the
68 child in the structure pointed to by
71 Other than the use of the
73 argument, the following
79 wait3(wstatus, options, rusage);
87 waitpid(\-1, wstatus, options);
91 Similarly, the following
97 wait4(pid, wstatus, options, rusage);
105 waitpid(pid, wstatus, options);
111 waits of any child, while
113 can be used to select a specific child, or children, on which to wait.
122 to which it points will be filled with accounting information
136 SUSv1 included a specification of
140 but marked it LEGACY;
145 is not required these days, but increases portability.
150 structure with fields of type
154 .SS C library/kernel differences
157 is a library function implemented on top of the