@@ -8,18 +8,27 @@ libc_bitflags!(
8
8
pub struct WaitPidFlag : c_int {
9
9
WNOHANG ;
10
10
WUNTRACED ;
11
+ #[ cfg( any( target_os = "freebsd" ,
12
+ target_os = "linux" ,
13
+ target_os = "android" ) ) ]
11
14
WEXITED ;
12
15
WCONTINUED ;
16
+ #[ cfg( any( target_os = "freebsd" ,
17
+ target_os = "linux" ,
18
+ target_os = "android" ) ) ]
13
19
WSTOPPED ;
14
20
/// Don't reap, just poll status.
21
+ #[ cfg( any( target_os = "freebsd" ,
22
+ target_os = "linux" ,
23
+ target_os = "android" ) ) ]
15
24
WNOWAIT ;
16
25
/// Don't wait on children of other threads in this group
17
26
#[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
18
27
__WNOTHREAD;
19
28
/// Wait on all children, regardless of type
20
- #[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
29
+ #[ cfg( any( target_os = "android" , target_os = "linux" , target_os = "netbsd" ) ) ]
21
30
__WALL;
22
- #[ cfg( any( target_os = "android" , target_os = "linux" ) ) ]
31
+ #[ cfg( any( target_os = "android" , target_os = "linux" , target_os = "netbsd" ) ) ]
23
32
__WCLONE;
24
33
}
25
34
) ;
@@ -74,7 +83,7 @@ pub enum WaitStatus {
74
83
/// child process. This is only returned if `WaitPidFlag::WNOHANG`
75
84
/// was used (otherwise `wait()` or `waitpid()` would block until
76
85
/// there was something to report).
77
- StillAlive
86
+ StillAlive ,
78
87
}
79
88
80
89
impl WaitStatus {
@@ -140,7 +149,7 @@ fn continued(status: i32) -> bool {
140
149
unsafe { libc:: WIFCONTINUED ( status) }
141
150
}
142
151
143
- fn decode ( pid : Pid , status : i32 ) -> WaitStatus {
152
+ fn decode ( pid : Pid , status : i32 ) -> WaitStatus {
144
153
if exited ( status) {
145
154
WaitStatus :: Exited ( pid, exit_status ( status) )
146
155
} else if signaled ( status) {
@@ -178,10 +187,16 @@ pub fn waitpid<P: Into<Option<Pid>>>(pid: P, options: Option<WaitPidFlag>) -> Re
178
187
179
188
let option_bits = match options {
180
189
Some ( bits) => bits. bits ( ) ,
181
- None => 0
190
+ None => 0 ,
182
191
} ;
183
192
184
- let res = unsafe { libc:: waitpid ( pid. into ( ) . unwrap_or ( Pid :: from_raw ( -1 ) ) . into ( ) , & mut status as * mut c_int , option_bits) } ;
193
+ let res = unsafe {
194
+ libc:: waitpid (
195
+ pid. into ( ) . unwrap_or ( Pid :: from_raw ( -1 ) ) . into ( ) ,
196
+ & mut status as * mut c_int ,
197
+ option_bits,
198
+ )
199
+ } ;
185
200
186
201
Ok ( match try!( Errno :: result ( res) ) {
187
202
0 => StillAlive ,
0 commit comments