Add W_EXITCODE to construct an exit code
On Linux, `sys/wait.h` defines a `W_EXITCODE` macro to construct an exit code from a return value and a signal number. Provide an equivalent function.
This commit is contained in:
parent
ab3c229140
commit
631da86c92
|
@ -1254,6 +1254,10 @@ f! {
|
|||
(status & 0x80) != 0
|
||||
}
|
||||
|
||||
pub fn W_EXITCODE(ret: ::c_int, sig: ::c_int) -> ::c_int {
|
||||
(ret << 8) | sig
|
||||
}
|
||||
|
||||
pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
|
||||
(cmd << 8) | (type_ & 0x00ff)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue