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.19:
24               _DEFAULT_SOURCE || _XOPEN_SOURCE >= 500
25           Glibc 2.19 and earlier:
26               _BSD_SOURCE || _XOPEN_SOURCE >= 500
27       wait4():
28           Since glibc 2.19:
29               _DEFAULT_SOURCE
30           Glibc 2.19 and earlier:
31               _BSD_SOURCE
32

DESCRIPTION

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

RETURN VALUE

66       As for waitpid(2).
67

ERRORS

69       As for waitpid(2).
70

CONFORMING TO

72       4.3BSD.
73
74       SUSv1 included a specification of wait3(); SUSv2 included wait3(),  but
75       marked it LEGACY; SUSv3 removed it.
76

NOTES

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

SEE ALSO

87       fork(2), getrusage(2), sigaction(2), signal(2), wait(2), signal(7)
88

COLOPHON

90       This page is part of release 4.15 of the Linux  man-pages  project.   A
91       description  of  the project, information about reporting bugs, and the
92       latest    version    of    this    page,    can     be     found     at
93       https://www.kernel.org/doc/man-pages/.
94
95
96
97Linux                             2017-09-15                          WAIT4(2)
Impressum