Skip to content

Commit 57298d0

Browse files
committed
Add W_STOPCODE to construct a stop code
On Linux, `sys/wait.h` defines a `W_STOPCODE` macro to construct a stop code from the signal number of a stopping signal. Provide an equivalent function. Suggested-by: Ivan Tham <[email protected]>
1 parent 631da86 commit 57298d0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/unix/linux_like/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,10 @@ f! {
12581258
(ret << 8) | sig
12591259
}
12601260

1261+
pub fn W_STOPCODE(sig: ::c_int) -> ::c_int {
1262+
(sig << 8) | 0x7f
1263+
}
1264+
12611265
pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
12621266
(cmd << 8) | (type_ & 0x00ff)
12631267
}

0 commit comments

Comments
 (0)