From 4c32b9f4b9c15ece4b22418d24d689a3efdb1d94 Mon Sep 17 00:00:00 2001 From: Mackenzie Clark <mackenzie.a.z.c@gmail.com> Date: Mon, 17 Dec 2018 17:45:06 -0800 Subject: [PATCH] move everything back into window mod with the type alias for msvc --- libc-test/build.rs | 1 + src/windows/gnu.rs | 12 ------------ src/windows/mod.rs | 14 ++++++++++++++ src/windows/msvc.rs | 11 ----------- 4 files changed, 15 insertions(+), 23 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 03b08473..0f86cb6f 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -373,6 +373,7 @@ fn main() { // Fixup a few types on windows that don't actually exist. "time64_t" if windows => "__time64_t".to_string(), "ssize_t" if windows => "SSIZE_T".to_string(), + "_crt_signal_t" if windows => "__p_sig_fn_t".to_string(), // OSX calls this something else "sighandler_t" if bsdlike => "sig_t".to_string(), diff --git a/src/windows/gnu.rs b/src/windows/gnu.rs index cb38f543..3568f622 100644 --- a/src/windows/gnu.rs +++ b/src/windows/gnu.rs @@ -1,19 +1,7 @@ -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; diff --git a/src/windows/mod.rs b/src/windows/mod.rs index f46eb362..8caef4ed 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -27,6 +27,7 @@ pub type ptrdiff_t = isize; pub type intptr_t = isize; pub type uintptr_t = usize; pub type ssize_t = isize; +pub type __p_sig_fn_t = usize; pub type c_char = i8; pub type c_long = i32; @@ -177,6 +178,16 @@ pub const ENOTEMPTY: ::c_int = 41; pub const EILSEQ: ::c_int = 42; pub const STRUNCATE: ::c_int = 80; +// signal codes +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; + // inline comment below appeases style checker #[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if " #[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))] @@ -287,6 +298,9 @@ extern { pub fn rand() -> c_int; pub fn srand(seed: c_uint); + pub fn signal(signum: c_int, handler: __p_sig_fn_t) -> __p_sig_fn_t; + pub fn raise(signum: c_int) -> c_int; + #[link_name = "_chmod"] pub fn chmod(path: *const c_char, mode: ::c_int) -> ::c_int; #[link_name = "_wchmod"] diff --git a/src/windows/msvc.rs b/src/windows/msvc.rs index 47ceafea..1ebfcadd 100644 --- a/src/windows/msvc.rs +++ b/src/windows/msvc.rs @@ -1,18 +1,7 @@ -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"] -- GitLab