1wait.h(3HEAD) Headers wait.h(3HEAD)
2
3
4
6 wait.h, wait - wait status
7
9 #include <sys/wait.h>
10
11
13 When a process waits for status from its children using either the
14 wait(3C) or waitpid(3C) function, the status returned can be evaluated
15 with the following macros, defined in <sys/wait.h>. These macros evalu‐
16 ate to integral expressions. The stat argument to these macros is the
17 integer value returned from wait() or waitpid().
18
19 WCOREDUMP(stat) If the value of WIFSIGNALED (stat) is non-zero,
20 this macro evaluates to a non-zero value if a
21 core image of the terminated child was created.
22
23
24 WEXITSTATUS(stat) If the value of WIFEXITED(stat) is non-zero,
25 this macro evaluates to the exit code that the
26 child process passed to _exit() (see exit(2)) or
27 exit(3C), or the value that the child process
28 returned from main.
29
30
31 WIFCONTINUED(stat) Evaluates to a non-zero value if status was
32 returned for a child process that has continued.
33
34
35 WIFEXITED(stat) Evaluates to a non-zero value if status was
36 returned for a child process that terminated nor‐
37 mally.
38
39
40 WIFSIGNALED(stat) Evaluates to a non-zero value if status was
41 returned for a child process that terminated due
42 to the receipt of a signal.
43
44
45 WIFSTOPPED(stat) Evaluates to a non-zero value if status was
46 returned for a child process that is currently
47 stopped.
48
49
50 WSTOPSIG(stat) If the value of WIFSTOPPED(stat) is non-zero,
51 this macro evaluates to the number of the signal
52 that caused the child process to stop.
53
54
55 WTERMSIG(stat) If the value of WIFSIGNALED(stat) is non-zero,
56 this macro evaluates to the number of the signal
57 that caused the termination of the child process.
58
59
60
61 The <sys/wait.h> header defines the symbolic constants listed below for
62 use with waitpid(3C).
63
64 WNOHANG Do not hang if no status is available; return immediately.
65
66
67 WUNTRACED Report status of stopped child process.
68
69
70
71 The symbolic constants listed below are defined as possible values for
72 the options argument to waitid(2).
73
74 WEXITED Wait for processes that have exited.
75
76
77 WSTOPPED Status is returned for any child that has stopped upon
78 receipt of a signal.
79
80
81 WCONTINUED Status is returned for any child that was stopped and has
82 been continued.
83
84
85 WNOHANG Return immediately if there are no children to wait for.
86
87
88 WNOWAIT Keep the process whose status is returned in infop in a
89 waitable state.
90
91
92
93 The type idtype_t is defined as an enumeration type whose possible val‐
94 ues include the following:
95
96 P_ALL
97 P_PID
98 P_PGID
99
100
101
102 The id_t and pid_t types are defined as described in <sys/types.h>.
103
104
105 The siginfo_t type is defined as described in <signal.h>.
106
107
108 The rusage structure is defined as described in <sys/resource.h>.
109
110
111 Inclusion of the <sys/wait.h> header can also make visible all symbols
112 from <signal.h> and <sys/resource.h>.
113
115 See attributes(5) for descriptions of the following attributes:
116
117
118
119
120 ┌─────────────────────────────┬─────────────────────────────┐
121 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
122 ├─────────────────────────────┼─────────────────────────────┤
123 │Interface Stability │Standard │
124 └─────────────────────────────┴─────────────────────────────┘
125
127 exit(2), waitid(2), exit(3C), wait(3C), waitpid(3C),attributes(5),
128 standards(5)
129
130
131
132SunOS 5.11 10 Sep 2004 wait.h(3HEAD)