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
This commit is contained in:
Mackenzie Clark 2018-12-16 16:23:53 -08:00
parent ed8309bc03
commit 313483ba2e
3 changed files with 26 additions and 2 deletions

View File

@ -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");

View File

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

View File

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