1WAIT4(2)                   Linux Programmer's Manual                  WAIT4(2)
2
3
4

NAME

6       wait3, wait4 - wait for process to change state, BSD style
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/time.h>
11       #include <sys/resource.h>
12       #include <sys/wait.h>
13
14       pid_t wait3(int *wstatus, int options,
15                   struct rusage *rusage);
16
17       pid_t wait4(pid_t pid, int *wstatus, int options,
18                   struct rusage *rusage);
19
20   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
21
22       wait3():
23           Since glibc 2.26:
24               _DEFAULT_SOURCE ||
25               (_XOPEN_SOURCE >= 500 &&
26                       ! (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600))
27           From glibc 2.19 to 2.25:
28               _DEFAULT_SOURCE || _XOPEN_SOURCE >= 500
29           Glibc 2.19 and earlier:
30               _BSD_SOURCE || _XOPEN_SOURCE >= 500
31       wait4():
32           Since glibc 2.19:
33               _DEFAULT_SOURCE
34           Glibc 2.19 and earlier:
35               _BSD_SOURCE
36

DESCRIPTION

38       These functions are nonstandard; in new programs, the use of waitpid(2)
39       or waitid(2) is preferable.
40
41       The wait3() and wait4() system calls are  similar  to  waitpid(2),  but
42       additionally  return  resource usage information about the child in the
43       structure pointed to by rusage.
44
45       Other than the use of the rusage argument, the following wait3() call:
46
47           wait3(wstatus, options, rusage);
48
49       is equivalent to:
50
51           waitpid(-1, wstatus, options);
52
53       Similarly, the following wait4() call:
54
55           wait4(pid, wstatus, options, rusage);
56
57       is equivalent to:
58
59           waitpid(pid, wstatus, options);
60
61       In other words, wait3() waits of any child, while wait4() can  be  used
62       to select a specific child, or children, on which to wait.  See wait(2)
63       for further details.
64
65       If rusage is not NULL, the struct rusage to which  it  points  will  be
66       filled  with  accounting information about the child.  See getrusage(2)
67       for details.
68

RETURN VALUE

70       As for waitpid(2).
71

ERRORS

73       As for waitpid(2).
74

CONFORMING TO

76       4.3BSD.
77
78       SUSv1 included a specification of wait3(); SUSv2 included wait3(),  but
79       marked it LEGACY; SUSv3 removed it.
80

NOTES

82       Including <sys/time.h> is not required these days, but increases porta‐
83       bility.  (Indeed, <sys/resource.h> defines the  rusage  structure  with
84       fields of type struct timeval defined in <sys/time.h>.)
85
86   C library/kernel differences
87       On  Linux,  wait3()  is  a  library  function implemented on top of the
88       wait4() system call.
89

SEE ALSO

91       fork(2), getrusage(2), sigaction(2), signal(2), wait(2), signal(7)
92

COLOPHON

94       This page is part of release 5.07 of the Linux  man-pages  project.   A
95       description  of  the project, information about reporting bugs, and the
96       latest    version    of    this    page,    can     be     found     at
97       https://www.kernel.org/doc/man-pages/.
98
99
100
101Linux                             2020-06-09                          WAIT4(2)
Impressum