Skip to content

Commit 334dcd8

Browse files
committed
add signal and raise bindings
1 parent ed8309b commit 334dcd8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ fn main() {
7676
cfg.header("windows.h");
7777
cfg.header("process.h");
7878
cfg.header("ws2ipdef.h");
79+
cfg.header("signal.h");
7980

8081
if target.contains("gnu") {
8182
cfg.header("ws2tcpip.h");

src/windows/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ pub type wchar_t = u16;
3535

3636
pub type clock_t = i32;
3737

38+
pub type _crt_signal_t = usize;
39+
3840
cfg_if! {
3941
if #[cfg(all(target_arch = "x86", target_env = "gnu"))] {
4042
pub type time_t = i32;
@@ -177,6 +179,14 @@ pub const ENOTEMPTY: ::c_int = 41;
177179
pub const EILSEQ: ::c_int = 42;
178180
pub const STRUNCATE: ::c_int = 80;
179181

182+
pub const SIGINT: ::c_int = 2;
183+
pub const SIGILL: ::c_int = 4;
184+
pub const SIGABRT: ::c_int = 22;
185+
pub const SIGFPE: ::c_int = 8;
186+
pub const SIGSEGV: ::c_int = 11;
187+
pub const SIGTERM: ::c_int = 15;
188+
pub const SIG_ERR: ::c_int = -1;
189+
180190
// inline comment below appeases style checker
181191
#[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if "
182192
#[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))]
@@ -286,6 +296,8 @@ extern {
286296
pub fn labs(i: c_long) -> c_long;
287297
pub fn rand() -> c_int;
288298
pub fn srand(seed: c_uint);
299+
pub fn signal(signum: c_int, handler: _crt_signal_t) -> _crt_signal_t;
300+
pub fn raise(signum: c_int) -> c_int;
289301

290302
#[link_name = "_chmod"]
291303
pub fn chmod(path: *const c_char, mode: ::c_int) -> ::c_int;

0 commit comments

Comments
 (0)