1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#![allow(non_snake_case, unsafe_code)]
use linux_raw_sys::ctypes::c_int;
pub(crate) use linux_raw_sys::general::{
siginfo_t, WCONTINUED, WEXITED, WNOHANG, WNOWAIT, WSTOPPED, WUNTRACED,
};
#[inline]
pub(crate) fn WIFSTOPPED(status: u32) -> bool {
(status & 0xff) == 0x7f
}
#[inline]
pub(crate) fn WSTOPSIG(status: u32) -> u32 {
(status >> 8) & 0xff
}
#[inline]
pub(crate) fn WIFCONTINUED(status: u32) -> bool {
status == 0xffff
}
#[inline]
pub(crate) fn WIFSIGNALED(status: u32) -> bool {
((status & 0x7f) + 1) as i8 >= 2
}
#[inline]
pub(crate) fn WTERMSIG(status: u32) -> u32 {
status & 0x7f
}
#[inline]
pub(crate) fn WIFEXITED(status: u32) -> bool {
(status & 0x7f) == 0
}
#[inline]
pub(crate) fn WEXITSTATUS(status: u32) -> u32 {
(status >> 8) & 0xff
}
pub(crate) trait SiginfoExt {
fn si_code(&self) -> c_int;
unsafe fn si_status(&self) -> c_int;
}
impl SiginfoExt for siginfo_t {
#[inline]
fn si_code(&self) -> c_int {
unsafe { self.__bindgen_anon_1.__bindgen_anon_1.si_code }
}
#[inline]
#[rustfmt::skip]
unsafe fn si_status(&self) -> c_int {
self.__bindgen_anon_1.__bindgen_anon_1._sifields._sigchld._status
}
}