summaryrefslogtreecommitdiff
path: root/libc/src/windows
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-14 09:37:41 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-14 09:37:41 -0800
commitd8e4f651a453a37345153a3dfc8593f2419b08af (patch)
tree72e161dd029d23253e64b747707848d3cca58527 /libc/src/windows
parente7ecdef19097428d81a8de65713cb7f36c780b57 (diff)
downloadnitrocli-d8e4f651a453a37345153a3dfc8593f2419b08af.tar.gz
nitrocli-d8e4f651a453a37345153a3dfc8593f2419b08af.tar.bz2
Update libc crate to 0.2.46
This change updates the libc crate to version 0.2.46. Import subrepo libc/:libc at a9e3cc6c1b529eaffef5b82934d0c47203edebe5
Diffstat (limited to 'libc/src/windows')
-rw-r--r--libc/src/windows/gnu.rs7
-rw-r--r--libc/src/windows/mod.rs67
-rw-r--r--libc/src/windows/msvc.rs2
3 files changed, 65 insertions, 11 deletions
diff --git a/libc/src/windows/gnu.rs b/libc/src/windows/gnu.rs
index a67af15..45e7dda 100644
--- a/libc/src/windows/gnu.rs
+++ b/libc/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/libc/src/windows/mod.rs b/libc/src/windows/mod.rs
index f46eb36..4bea459 100644
--- a/libc/src/windows/mod.rs
+++ b/libc/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;
@@ -49,6 +50,8 @@ pub type ino_t = u16;
pub enum timezone {}
pub type time64_t = i64;
+pub type SOCKET = ::uintptr_t;
+
s! {
// note this is the struct called stat64 in Windows. Not stat, nor stati64.
pub struct stat {
@@ -72,15 +75,15 @@ s! {
}
pub struct tm {
- tm_sec: ::c_int,
- tm_min: ::c_int,
- tm_hour: ::c_int,
- tm_mday: ::c_int,
- tm_mon: ::c_int,
- tm_year: ::c_int,
- tm_wday: ::c_int,
- tm_yday: ::c_int,
- tm_isdst: ::c_int,
+ pub tm_sec: ::c_int,
+ pub tm_min: ::c_int,
+ pub tm_hour: ::c_int,
+ pub tm_mday: ::c_int,
+ pub tm_mon: ::c_int,
+ pub tm_year: ::c_int,
+ pub tm_wday: ::c_int,
+ pub tm_yday: ::c_int,
+ pub tm_isdst: ::c_int,
}
pub struct timeval {
@@ -92,6 +95,11 @@ s! {
pub tv_sec: time_t,
pub tv_nsec: c_long,
}
+
+ pub struct sockaddr {
+ pub sa_family: c_ushort,
+ pub sa_data: [c_char; 14],
+ }
}
pub const INT_MIN: c_int = -2147483648;
@@ -177,6 +185,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 +305,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"]
@@ -369,6 +390,34 @@ extern {
locale: *const wchar_t) -> *mut wchar_t;
}
+extern "system" {
+ pub fn listen(s: SOCKET, backlog: ::c_int) -> ::c_int;
+ pub fn accept(s: SOCKET, addr: *mut ::sockaddr,
+ addrlen: *mut ::c_int) -> SOCKET;
+ pub fn bind(s: SOCKET, name: *const ::sockaddr,
+ namelen: ::c_int) -> ::c_int;
+ pub fn connect(s: SOCKET, name: *const ::sockaddr,
+ namelen: ::c_int) -> ::c_int;
+ pub fn getpeername(s: SOCKET, name: *mut ::sockaddr,
+ nameln: *mut ::c_int) -> ::c_int;
+ pub fn getsockname(s: SOCKET, name: *mut ::sockaddr,
+ nameln: *mut ::c_int) -> ::c_int;
+ pub fn getsockopt(s: SOCKET, level: ::c_int, optname: ::c_int,
+ optval: *mut ::c_char,
+ optlen: *mut ::c_int) -> ::c_int;
+ pub fn recvfrom(s: SOCKET, buf: *mut ::c_char, len: ::c_int,
+ flags: ::c_int, from: *mut ::sockaddr,
+ fromlen: *mut ::c_int) -> ::c_int;
+ pub fn sendto(s: SOCKET, buf: *const ::c_char, len: ::c_int,
+ flags: ::c_int, to: *const ::sockaddr,
+ tolen: ::c_int) -> ::c_int;
+ pub fn setsockopt(s: SOCKET, level: ::c_int, optname: ::c_int,
+ optval: *const ::c_char,
+ optlen: ::c_int) -> ::c_int;
+ pub fn socket(af: ::c_int, socket_type: ::c_int,
+ protocol: ::c_int) -> SOCKET;
+}
+
cfg_if! {
if #[cfg(core_cvoid)] {
pub use core::ffi::c_void;
diff --git a/libc/src/windows/msvc.rs b/libc/src/windows/msvc.rs
index 9e2a9b9..1ebfcad 100644
--- a/libc/src/windows/msvc.rs
+++ b/libc/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
+}