Skip to content

Commit 70445ed

Browse files
committed
separate for gnu and msvc
1 parent 334dcd8 commit 70445ed

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

src/windows/gnu.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
1+
pub type __p_sig_fn_t = usize;
2+
13
pub const L_tmpnam: ::c_uint = 14;
24
pub const TMP_MAX: ::c_uint = 0x7fff;
5+
pub const SIGHUP: ::c_int = 1;
6+
pub const SIGINT: ::c_int = 2;
7+
pub const SIGQUIT: ::c_int = 3;
8+
pub const SIGILL: ::c_int = 4;
9+
pub const SIGTRAP: ::c_int = 5;
10+
pub const SIGIOT: ::c_int = 6;
11+
pub const SIGEMT: ::c_int = 7;
12+
pub const SIGFPE: ::c_int = 8;
13+
pub const SIGKILL: ::c_int = 9;
14+
pub const SIGBUS: ::c_int = 10;
15+
pub const SIGSEGV: ::c_int = 11;
16+
pub const SIGSYS: ::c_int = 12;
17+
pub const SIGPIPE: ::c_int = 13;
18+
pub const SIGALRM: ::c_int = 14;
19+
pub const SIGTERM: ::c_int = 15;
20+
pub const SIGABRT: ::c_int = 22;
21+
pub const NSIG: ::c_int = 23;
22+
pub const SIG_ERR: ::c_int = -1;
323

424
extern {
25+
pub fn signal(signum: c_int, handler: __p_sig_fn_t) -> __p_sig_fn_t;
26+
pub fn raise(signum: c_int) -> c_int;
527
pub fn strcasecmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
628
pub fn strncasecmp(s1: *const ::c_char, s2: *const ::c_char,
7-
n: ::size_t) -> ::c_int;
29+
n: ::size_t) -> ::c_int;
830
}

src/windows/mod.rs

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

3636
pub type clock_t = i32;
3737

38-
pub type _crt_signal_t = usize;
39-
4038
cfg_if! {
4139
if #[cfg(all(target_arch = "x86", target_env = "gnu"))] {
4240
pub type time_t = i32;
@@ -179,14 +177,6 @@ pub const ENOTEMPTY: ::c_int = 41;
179177
pub const EILSEQ: ::c_int = 42;
180178
pub const STRUNCATE: ::c_int = 80;
181179

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-
190180
// inline comment below appeases style checker
191181
#[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if "
192182
#[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))]
@@ -296,8 +286,6 @@ extern {
296286
pub fn labs(i: c_long) -> c_long;
297287
pub fn rand() -> c_int;
298288
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;
301289

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

src/windows/msvc.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1+
pub type _crt_signal_t = usize;
2+
13
pub const L_tmpnam: ::c_uint = 260;
24
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;
312

413
extern {
14+
pub fn signal(signum: c_int, handler: _crt_signal_t) -> _crt_signal_t;
15+
pub fn raise(signum: c_int) -> c_int;
516
#[link_name = "_stricmp"]
617
pub fn stricmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
718
#[link_name = "_strnicmp"]
819
pub fn strnicmp(s1: *const ::c_char, s2: *const ::c_char,
920
n: ::size_t) -> ::c_int;
10-
}
21+
}

0 commit comments

Comments
 (0)