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:
Josh Triplett 2020-08-09 16:35:24 -07:00
parent ab3c229140
commit 631da86c92
1 changed files with 4 additions and 0 deletions

View File

@ -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)
}