summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc-test/build.rs6
-rw-r--r--src/dox.rs5
-rw-r--r--src/unix/bsd/apple/mod.rs20
-rw-r--r--src/windows/gnu.rs7
-rw-r--r--src/windows/mod.rs14
-rw-r--r--src/windows/msvc.rs2
6 files changed, 51 insertions, 3 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index e6c9c7907d..ffab452301 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");
@@ -372,7 +373,9 @@ 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(),
-
+ // windows
+ "sighandler_t" if windows && !mingw => "_crt_signal_t".to_string(),
+ "sighandler_t" if windows && mingw => "__p_sig_fn_t".to_string(),
// OSX calls this something else
"sighandler_t" if bsdlike => "sig_t".to_string(),
@@ -507,6 +510,7 @@ fn main() {
n if n.starts_with("P") => true,
n if n.starts_with("H") => true,
n if n.starts_with("LP") => true,
+ "__p_sig_fn_t" if mingw => true,
_ => false,
}
});
diff --git a/src/dox.rs b/src/dox.rs
index 33a9c166f4..6296c6c025 100644
--- a/src/dox.rs
+++ b/src/dox.rs
@@ -52,6 +52,11 @@ mod imp {
#[lang = "sized"]
pub trait Sized {}
+ #[lang = "receiver"]
+ pub trait Receiver {}
+ impl<T: ?Sized> Receiver for &T {}
+ impl<T: ?Sized> Receiver for &mut T {}
+
macro_rules! each_int {
($mac:ident) => {
$mac!(u8);
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index b89ba25b3c..4d41027ada 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -1917,6 +1917,13 @@ pub const IUTF8: ::tcflag_t = 0x00004000;
pub const CRTSCTS: ::tcflag_t = 0x00030000;
pub const NI_MAXHOST: ::socklen_t = 1025;
+pub const NI_MAXSERV: ::socklen_t = 32;
+pub const NI_NOFQDN: ::c_int = 0x00000001;
+pub const NI_NUMERICHOST: ::c_int = 0x00000002;
+pub const NI_NAMEREQD: ::c_int = 0x00000004;
+pub const NI_NUMERICSERV: ::c_int = 0x00000008;
+pub const NI_NUMERICSCOPE: ::c_int = 0x00000100;
+pub const NI_DGRAM: ::c_int = 0x00000010;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
@@ -2150,6 +2157,19 @@ pub const PRIO_DARWIN_NONUI: ::c_int = 0x1001;
pub const SEM_FAILED: *mut sem_t = -1isize as *mut ::sem_t;
+pub const AI_PASSIVE: ::c_int = 0x00000001;
+pub const AI_CANONNAME: ::c_int = 0x00000002;
+pub const AI_NUMERICHOST: ::c_int = 0x00000004;
+pub const AI_NUMERICSERV: ::c_int = 0x00001000;
+pub const AI_MASK: ::c_int = AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST |
+ AI_NUMERICSERV | AI_ADDRCONFIG;
+pub const AI_ALL: ::c_int = 0x00000100;
+pub const AI_V4MAPPED_CFG: ::c_int = 0x00000200;
+pub const AI_ADDRCONFIG: ::c_int = 0x00000400;
+pub const AI_V4MAPPED: ::c_int = 0x00000800;
+pub const AI_DEFAULT: ::c_int = AI_V4MAPPED_CFG | AI_ADDRCONFIG;
+pub const AI_UNUSABLE: ::c_int = 0x10000000;
+
pub const SIGEV_NONE: ::c_int = 0;
pub const SIGEV_SIGNAL: ::c_int = 1;
pub const SIGEV_THREAD: ::c_int = 3;
diff --git a/src/windows/gnu.rs b/src/windows/gnu.rs
index a67af15a8f..45e7ddaea4 100644
--- a/src/windows/gnu.rs
+++ b/src/windows/gnu.rs
@@ -1,8 +1,13 @@
pub const L_tmpnam: ::c_uint = 14;
pub const TMP_MAX: ::c_uint = 0x7fff;
+// stdio file descriptor numbers
+pub const STDIN_FILENO: ::c_int = 0;
+pub const STDOUT_FILENO: ::c_int = 1;
+pub const STDERR_FILENO: ::c_int = 2;
+
extern {
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/mod.rs b/src/windows/mod.rs
index f46eb362d8..e4db343ec2 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 sighandler_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: sighandler_t) -> sighandler_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 9e2a9b9e5d..1ebfcadd16 100644
--- a/src/windows/msvc.rs
+++ b/src/windows/msvc.rs
@@ -7,4 +7,4 @@ extern {
#[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
+}