diff options
author | Mackenzie Clark <mackenzie.a.z.c@gmail.com> | 2018-12-16 16:23:53 -0800 |
---|---|---|
committer | Mackenzie Clark <mackenzie.a.z.c@gmail.com> | 2018-12-16 16:23:53 -0800 |
commit | 313483ba2ef5aa1f70a137952c696cf499e3f0e3 (patch) | |
tree | 4048de624fbc47b6f7201c025a6f8b749131b8e0 | |
parent | ed8309bc03ba32c9f407d1800ad6d51ade19cdb0 (diff) | |
download | rust-libc-313483ba2ef5aa1f70a137952c696cf499e3f0e3.tar.gz |
add signal and raise bindings
separate for gnu and msvc
scope resolve c_int
these types are not allowed, and more scope resolution
use size_t
-rw-r--r-- | libc-test/build.rs | 1 | ||||
-rw-r--r-- | src/windows/gnu.rs | 14 | ||||
-rw-r--r-- | src/windows/msvc.rs | 13 |
3 files changed, 26 insertions, 2 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs index e6c9c7907d..d41d561ff7 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -76,6 +76,7 @@ fn main() { cfg.header("windows.h"); cfg.header("process.h"); cfg.header("ws2ipdef.h"); + cfg.header("signal.h"); if target.contains("gnu") { cfg.header("ws2tcpip.h"); diff --git a/src/windows/gnu.rs b/src/windows/gnu.rs index a67af15a8f..cb38f543ca 100644 --- a/src/windows/gnu.rs +++ b/src/windows/gnu.rs @@ -1,8 +1,20 @@ +pub type __p_sig_fn_t = ::size_t; + pub const L_tmpnam: ::c_uint = 14; pub const TMP_MAX: ::c_uint = 0x7fff; +pub const SIGINT: ::c_int = 2; +pub const SIGILL: ::c_int = 4; +pub const SIGFPE: ::c_int = 8; +pub const SIGSEGV: ::c_int = 11; +pub const SIGTERM: ::c_int = 15; +pub const SIGABRT: ::c_int = 22; +pub const NSIG: ::c_int = 23; +pub const SIG_ERR: ::c_int = -1; extern { + pub fn signal(signum: ::c_int, handler: __p_sig_fn_t) -> __p_sig_fn_t; + pub fn raise(signum: ::c_int) -> ::c_int; pub fn strcasecmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int; pub fn strncasecmp(s1: *const ::c_char, s2: *const ::c_char, - n: ::size_t) -> ::c_int; + n: ::size_t) -> ::c_int; } diff --git a/src/windows/msvc.rs b/src/windows/msvc.rs index 9e2a9b9e5d..47ceafea3a 100644 --- a/src/windows/msvc.rs +++ b/src/windows/msvc.rs @@ -1,10 +1,21 @@ +pub type _crt_signal_t = ::size_t; + pub const L_tmpnam: ::c_uint = 260; pub const TMP_MAX: ::c_uint = 0x7fff_ffff; +pub const SIGINT: ::c_int = 2; +pub const SIGILL: ::c_int = 4; +pub const SIGABRT: ::c_int = 22; +pub const SIGFPE: ::c_int = 8; +pub const SIGSEGV: ::c_int = 11; +pub const SIGTERM: ::c_int = 15; +pub const SIG_ERR: ::c_int = -1; extern { + pub fn signal(signum: ::c_int, handler: _crt_signal_t) -> _crt_signal_t; + pub fn raise(signum: ::c_int) -> ::c_int; #[link_name = "_stricmp"] pub fn stricmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int; #[link_name = "_strnicmp"] pub fn strnicmp(s1: *const ::c_char, s2: *const ::c_char, n: ::size_t) -> ::c_int; -}
\ No newline at end of file +} |