Skip to content

Commit 4c32b9f

Browse files
committed
move everything back into window mod with the type alias for msvc
1 parent 2f25aaa commit 4c32b9f

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ fn main() {
373373
// Fixup a few types on windows that don't actually exist.
374374
"time64_t" if windows => "__time64_t".to_string(),
375375
"ssize_t" if windows => "SSIZE_T".to_string(),
376+
"_crt_signal_t" if windows => "__p_sig_fn_t".to_string(),
376377

377378
// OSX calls this something else
378379
"sighandler_t" if bsdlike => "sig_t".to_string(),

src/windows/gnu.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
pub type __p_sig_fn_t = ::size_t;
2-
31
pub const L_tmpnam: ::c_uint = 14;
42
pub const TMP_MAX: ::c_uint = 0x7fff;
5-
pub const SIGINT: ::c_int = 2;
6-
pub const SIGILL: ::c_int = 4;
7-
pub const SIGFPE: ::c_int = 8;
8-
pub const SIGSEGV: ::c_int = 11;
9-
pub const SIGTERM: ::c_int = 15;
10-
pub const SIGABRT: ::c_int = 22;
11-
pub const NSIG: ::c_int = 23;
12-
pub const SIG_ERR: ::c_int = -1;
133

144
extern {
15-
pub fn signal(signum: ::c_int, handler: __p_sig_fn_t) -> __p_sig_fn_t;
16-
pub fn raise(signum: ::c_int) -> ::c_int;
175
pub fn strcasecmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
186
pub fn strncasecmp(s1: *const ::c_char, s2: *const ::c_char,
197
n: ::size_t) -> ::c_int;

src/windows/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub type ptrdiff_t = isize;
2727
pub type intptr_t = isize;
2828
pub type uintptr_t = usize;
2929
pub type ssize_t = isize;
30+
pub type __p_sig_fn_t = usize;
3031

3132
pub type c_char = i8;
3233
pub type c_long = i32;
@@ -177,6 +178,16 @@ pub const ENOTEMPTY: ::c_int = 41;
177178
pub const EILSEQ: ::c_int = 42;
178179
pub const STRUNCATE: ::c_int = 80;
179180

181+
// signal codes
182+
pub const SIGINT: ::c_int = 2;
183+
pub const SIGILL: ::c_int = 4;
184+
pub const SIGFPE: ::c_int = 8;
185+
pub const SIGSEGV: ::c_int = 11;
186+
pub const SIGTERM: ::c_int = 15;
187+
pub const SIGABRT: ::c_int = 22;
188+
pub const NSIG: ::c_int = 23;
189+
pub const SIG_ERR: ::c_int = -1;
190+
180191
// inline comment below appeases style checker
181192
#[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if "
182193
#[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))]
@@ -287,6 +298,9 @@ extern {
287298
pub fn rand() -> c_int;
288299
pub fn srand(seed: c_uint);
289300

301+
pub fn signal(signum: c_int, handler: __p_sig_fn_t) -> __p_sig_fn_t;
302+
pub fn raise(signum: c_int) -> c_int;
303+
290304
#[link_name = "_chmod"]
291305
pub fn chmod(path: *const c_char, mode: ::c_int) -> ::c_int;
292306
#[link_name = "_wchmod"]

src/windows/msvc.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
pub type _crt_signal_t = ::size_t;
2-
31
pub const L_tmpnam: ::c_uint = 260;
42
pub const TMP_MAX: ::c_uint = 0x7fff_ffff;
5-
pub const SIGINT: ::c_int = 2;
6-
pub const SIGILL: ::c_int = 4;
7-
pub const SIGABRT: ::c_int = 22;
8-
pub const SIGFPE: ::c_int = 8;
9-
pub const SIGSEGV: ::c_int = 11;
10-
pub const SIGTERM: ::c_int = 15;
11-
pub const SIG_ERR: ::c_int = -1;
123

134
extern {
14-
pub fn signal(signum: ::c_int, handler: _crt_signal_t) -> _crt_signal_t;
15-
pub fn raise(signum: ::c_int) -> ::c_int;
165
#[link_name = "_stricmp"]
176
pub fn stricmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
187
#[link_name = "_strnicmp"]

0 commit comments

Comments
 (0)