Skip to content
Snippets Groups Projects
Commit 631da86c authored by Josh Triplett's avatar Josh Triplett
Browse files

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.
parent ab3c2291
No related branches found
No related tags found
No related merge requests found
...@@ -1254,6 +1254,10 @@ f! { ...@@ -1254,6 +1254,10 @@ f! {
(status & 0x80) != 0 (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 { pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
(cmd << 8) | (type_ & 0x00ff) (cmd << 8) | (type_ & 0x00ff)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment