Windows working again
This commit is contained in:
parent
e001d8cc3b
commit
bfc6ebc92b
22
src/lib.rs
22
src/lib.rs
@ -86,7 +86,7 @@ cfg_if! {
|
||||
sizep: *mut size_t)
|
||||
-> c_int;
|
||||
}
|
||||
} else {
|
||||
} else if #[cfg(unix)] {
|
||||
extern {
|
||||
pub fn sysctl(name: *mut c_int,
|
||||
namelen: c_int,
|
||||
@ -98,6 +98,8 @@ cfg_if! {
|
||||
pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
|
||||
-> c_int;
|
||||
}
|
||||
} else {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,23 +125,19 @@ extern {
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "freopen$UNIX2003")]
|
||||
pub fn freopen(filename: *const c_char, mode: *const c_char,
|
||||
file: *mut FILE)
|
||||
-> *mut FILE;
|
||||
file: *mut FILE) -> *mut FILE;
|
||||
pub fn fflush(file: *mut FILE) -> c_int;
|
||||
pub fn fclose(file: *mut FILE) -> c_int;
|
||||
pub fn remove(filename: *const c_char) -> c_int;
|
||||
pub fn rename(oldname: *const c_char,
|
||||
newname: *const c_char) -> c_int;
|
||||
pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
|
||||
pub fn tmpfile() -> *mut FILE;
|
||||
pub fn setvbuf(stream: *mut FILE,
|
||||
buffer: *mut c_char,
|
||||
mode: c_int,
|
||||
size: size_t)
|
||||
-> c_int;
|
||||
size: size_t) -> c_int;
|
||||
pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
|
||||
pub fn fgetc(stream: *mut FILE) -> c_int;
|
||||
pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
|
||||
-> *mut c_char;
|
||||
pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
|
||||
pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fputs$UNIX2003")]
|
||||
@ -158,8 +156,7 @@ extern {
|
||||
nobj: size_t,
|
||||
stream: *mut FILE)
|
||||
-> size_t;
|
||||
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int)
|
||||
-> c_int;
|
||||
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
|
||||
pub fn ftell(stream: *mut FILE) -> c_long;
|
||||
pub fn rewind(stream: *mut FILE);
|
||||
pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
|
||||
@ -173,8 +170,7 @@ extern {
|
||||
pub fn atoi(s: *const c_char) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "strtod$UNIX2003")]
|
||||
pub fn strtod(s: *const c_char,
|
||||
endp: *mut *mut c_char) -> c_double;
|
||||
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
|
||||
pub fn strtol(s: *const c_char,
|
||||
endp: *mut *mut c_char, base: c_int) -> c_long;
|
||||
pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
|
||||
|
506
src/windows.rs
506
src/windows.rs
@ -1,17 +1,103 @@
|
||||
pub type c_char = i8;
|
||||
pub type c_schar = i8;
|
||||
pub type c_uchar = u8;
|
||||
pub type c_short = i16;
|
||||
pub type c_ushort = u16;
|
||||
pub type c_int = i32;
|
||||
pub type c_uint = u32;
|
||||
pub type c_long = i32;
|
||||
pub type c_ulong = u32;
|
||||
pub type c_float = f32;
|
||||
pub type c_double = f64;
|
||||
pub type wchar_t = u16;
|
||||
pub type c_longlong = i64;
|
||||
pub type c_ulonglong = u64;
|
||||
pub type intmax_t = i64;
|
||||
pub type uintmax_t = u64;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(target_arch = "x86")] {
|
||||
pub type intptr_t = i32;
|
||||
pub type ptrdiff_t = i32;
|
||||
pub type size_t = u32;
|
||||
pub type ssize_t = i32;
|
||||
pub type uintptr_t = u32;
|
||||
pub type LONG_PTR = c_long;
|
||||
} else if #[cfg(target_arch = "x86_64")] {
|
||||
pub type intptr_t = i64;
|
||||
pub type ptrdiff_t = i64;
|
||||
pub type size_t = u64;
|
||||
pub type ssize_t = i64;
|
||||
pub type uintptr_t = u64;
|
||||
pub type LONG_PTR = i64;
|
||||
} else {
|
||||
// unknown arch
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub mod os {
|
||||
pub mod common {
|
||||
pub mod posix01 {
|
||||
use types::os::arch::c95::{c_short, time_t, c_long};
|
||||
use types::os::arch::extra::{time64_t};
|
||||
use types::os::arch::posix88::{dev_t, ino_t};
|
||||
pub type clock_t = i32;
|
||||
|
||||
// pub Note: this is the struct called stat64 in Windows. Not
|
||||
// stat, nor stati64.
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct stat {
|
||||
cfg_if! {
|
||||
if #[cfg(all(target_arch = "x86", target_env = "gnu"))] {
|
||||
pub type time_t = i32;
|
||||
} else {
|
||||
pub type time_t = i64;
|
||||
}
|
||||
}
|
||||
|
||||
pub type off_t = i32;
|
||||
pub type dev_t = u32;
|
||||
pub type ino_t = u16;
|
||||
pub enum timezone {}
|
||||
pub type time64_t = i64;
|
||||
|
||||
pub type BOOL = c_int;
|
||||
pub type BYTE = u8;
|
||||
pub type BOOLEAN = BYTE;
|
||||
pub type CCHAR = c_char;
|
||||
pub type CHAR = c_char;
|
||||
pub type DWORD = c_ulong;
|
||||
pub type DWORDLONG = c_ulonglong;
|
||||
pub type HANDLE = LPVOID;
|
||||
pub type HINSTANCE = HANDLE;
|
||||
pub type HMODULE = HINSTANCE;
|
||||
pub type LONG = c_long;
|
||||
pub type PLONG = *mut c_long;
|
||||
pub type LARGE_INTEGER = c_longlong;
|
||||
pub type PLARGE_INTEGER = *mut c_longlong;
|
||||
pub type LPCWSTR = *const WCHAR;
|
||||
pub type LPCSTR = *const CHAR;
|
||||
pub type LPWSTR = *mut WCHAR;
|
||||
pub type LPSTR = *mut CHAR;
|
||||
pub type LPWCH = *mut WCHAR;
|
||||
pub type LPCH = *mut CHAR;
|
||||
pub type SOCKET = uintptr_t;
|
||||
pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
|
||||
pub type LPVOID = *mut ::c_void;
|
||||
pub type LPCVOID = *const ::c_void;
|
||||
pub type LPBYTE = *mut BYTE;
|
||||
pub type LPWORD = *mut WORD;
|
||||
pub type LPDWORD = *mut DWORD;
|
||||
pub type LPHANDLE = *mut HANDLE;
|
||||
pub type LRESULT = LONG_PTR;
|
||||
pub type PBOOL = *mut BOOL;
|
||||
pub type WCHAR = wchar_t;
|
||||
pub type WORD = u16;
|
||||
pub type SIZE_T = size_t;
|
||||
pub type GROUP = c_uint;
|
||||
pub type LPSTARTUPINFOW = *mut STARTUPINFOW;
|
||||
pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
|
||||
pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
|
||||
pub type PMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
|
||||
pub type LPOVERLAPPED = *mut OVERLAPPED;
|
||||
pub type LPFILETIME = *mut FILETIME;
|
||||
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
|
||||
pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
|
||||
pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
|
||||
|
||||
s! {
|
||||
// note this is the struct called stat64 in Windows. Not stat, nor stati64.
|
||||
pub struct stat {
|
||||
pub st_dev: dev_t,
|
||||
pub st_ino: ino_t,
|
||||
pub st_mode: u16,
|
||||
@ -26,82 +112,67 @@
|
||||
}
|
||||
|
||||
// note that this is called utimbuf64 in Windows
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct utimbuf {
|
||||
pub struct utimbuf {
|
||||
pub actime: time64_t,
|
||||
pub modtime: time64_t,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct timeval {
|
||||
pub struct timeval {
|
||||
pub tv_sec: c_long,
|
||||
pub tv_usec: c_long,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct timespec {
|
||||
pub struct timespec {
|
||||
pub tv_sec: time_t,
|
||||
pub tv_nsec: c_long,
|
||||
}
|
||||
|
||||
pub enum timezone {}
|
||||
}
|
||||
|
||||
pub mod bsd44 {
|
||||
use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
|
||||
use types::os::arch::c99::uintptr_t;
|
||||
|
||||
pub type SOCKET = uintptr_t;
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct sockaddr {
|
||||
pub struct sockaddr {
|
||||
pub sa_family: u16,
|
||||
pub sa_data: [u8; 14],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Copy)] pub struct sockaddr_storage {
|
||||
|
||||
pub struct sockaddr_storage {
|
||||
pub ss_family: u16,
|
||||
__ss_pad1: [u8; 6],
|
||||
__ss_align: i64,
|
||||
__ss_pad2: [u8; 112],
|
||||
}
|
||||
impl Clone for sockaddr_storage {
|
||||
fn clone(&self) -> sockaddr_storage { *self }
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct sockaddr_in {
|
||||
|
||||
pub struct sockaddr_in {
|
||||
pub sin_family: u16,
|
||||
pub sin_port: u16,
|
||||
pub sin_addr: in_addr,
|
||||
pub sin_zero: [u8; 8],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct in_addr {
|
||||
|
||||
pub struct in_addr {
|
||||
pub s_addr: u32,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct sockaddr_in6 {
|
||||
|
||||
pub struct sockaddr_in6 {
|
||||
pub sin6_family: u16,
|
||||
pub sin6_port: u16,
|
||||
pub sin6_flowinfo: u32,
|
||||
pub sin6_addr: in6_addr,
|
||||
pub sin6_scope_id: u32,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct in6_addr {
|
||||
|
||||
pub struct in6_addr {
|
||||
pub s6_addr: [u16; 8],
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct ip_mreq {
|
||||
|
||||
pub struct ip_mreq {
|
||||
pub imr_multiaddr: in_addr,
|
||||
pub imr_interface: in_addr,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct ipv6_mreq {
|
||||
|
||||
pub struct ipv6_mreq {
|
||||
pub ipv6mr_multiaddr: in6_addr,
|
||||
pub ipv6mr_interface: c_uint,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct addrinfo {
|
||||
|
||||
pub struct addrinfo {
|
||||
pub ai_flags: c_int,
|
||||
pub ai_family: c_int,
|
||||
pub ai_socktype: c_int,
|
||||
@ -111,148 +182,14 @@
|
||||
pub ai_addr: *mut sockaddr,
|
||||
pub ai_next: *mut addrinfo,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod arch {
|
||||
pub mod c95 {
|
||||
pub type c_char = i8;
|
||||
pub type c_schar = i8;
|
||||
pub type c_uchar = u8;
|
||||
pub type c_short = i16;
|
||||
pub type c_ushort = u16;
|
||||
pub type c_int = i32;
|
||||
pub type c_uint = u32;
|
||||
pub type c_long = i32;
|
||||
pub type c_ulong = u32;
|
||||
pub type c_float = f32;
|
||||
pub type c_double = f64;
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub type size_t = u32;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub type size_t = u64;
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub type ptrdiff_t = i32;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub type ptrdiff_t = i64;
|
||||
|
||||
pub type clock_t = i32;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(all(target_arch = "x86", target_env = "gnu"))] {
|
||||
pub type time_t = i32;
|
||||
} else {
|
||||
pub type time_t = i64;
|
||||
}
|
||||
}
|
||||
|
||||
pub type wchar_t = u16;
|
||||
}
|
||||
|
||||
pub mod c99 {
|
||||
pub type c_longlong = i64;
|
||||
pub type c_ulonglong = u64;
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub type intptr_t = i32;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub type intptr_t = i64;
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub type uintptr_t = u32;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub type uintptr_t = u64;
|
||||
|
||||
pub type intmax_t = i64;
|
||||
pub type uintmax_t = u64;
|
||||
}
|
||||
|
||||
pub mod posix88 {
|
||||
pub type off_t = i32;
|
||||
pub type dev_t = u32;
|
||||
pub type ino_t = u16;
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub type ssize_t = i32;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub type ssize_t = i64;
|
||||
}
|
||||
|
||||
pub mod posix01 {
|
||||
}
|
||||
pub mod posix08 {
|
||||
}
|
||||
pub mod bsd44 {
|
||||
}
|
||||
pub mod extra {
|
||||
use consts::os::extra::{MAX_PROTOCOL_CHAIN,
|
||||
WSAPROTOCOL_LEN};
|
||||
use types::common::c95::c_void;
|
||||
use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
|
||||
use types::os::arch::c95::{c_long, c_ulong};
|
||||
use types::os::arch::c95::{wchar_t};
|
||||
use types::os::arch::c99::{c_ulonglong, c_longlong, uintptr_t};
|
||||
|
||||
pub type BOOL = c_int;
|
||||
pub type BYTE = u8;
|
||||
pub type BOOLEAN = BYTE;
|
||||
pub type CCHAR = c_char;
|
||||
pub type CHAR = c_char;
|
||||
|
||||
pub type DWORD = c_ulong;
|
||||
pub type DWORDLONG = c_ulonglong;
|
||||
|
||||
pub type HANDLE = LPVOID;
|
||||
pub type HINSTANCE = HANDLE;
|
||||
pub type HMODULE = HINSTANCE;
|
||||
|
||||
pub type LONG = c_long;
|
||||
pub type PLONG = *mut c_long;
|
||||
|
||||
#[cfg(target_arch = "x86")]
|
||||
pub type LONG_PTR = c_long;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub type LONG_PTR = i64;
|
||||
|
||||
pub type LARGE_INTEGER = c_longlong;
|
||||
pub type PLARGE_INTEGER = *mut c_longlong;
|
||||
|
||||
pub type LPCWSTR = *const WCHAR;
|
||||
pub type LPCSTR = *const CHAR;
|
||||
|
||||
pub type LPWSTR = *mut WCHAR;
|
||||
pub type LPSTR = *mut CHAR;
|
||||
|
||||
pub type LPWCH = *mut WCHAR;
|
||||
pub type LPCH = *mut CHAR;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct SECURITY_ATTRIBUTES {
|
||||
pub struct SECURITY_ATTRIBUTES {
|
||||
pub nLength: DWORD,
|
||||
pub lpSecurityDescriptor: LPVOID,
|
||||
pub bInheritHandle: BOOL,
|
||||
}
|
||||
pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
|
||||
|
||||
pub type LPVOID = *mut c_void;
|
||||
pub type LPCVOID = *const c_void;
|
||||
pub type LPBYTE = *mut BYTE;
|
||||
pub type LPWORD = *mut WORD;
|
||||
pub type LPDWORD = *mut DWORD;
|
||||
pub type LPHANDLE = *mut HANDLE;
|
||||
|
||||
pub type LRESULT = LONG_PTR;
|
||||
pub type PBOOL = *mut BOOL;
|
||||
pub type WCHAR = wchar_t;
|
||||
pub type WORD = u16;
|
||||
pub type SIZE_T = size_t;
|
||||
|
||||
pub type time64_t = i64;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct STARTUPINFOW {
|
||||
pub struct STARTUPINFOW {
|
||||
pub cb: DWORD,
|
||||
pub lpReserved: LPWSTR,
|
||||
pub lpDesktop: LPWSTR,
|
||||
@ -272,19 +209,15 @@
|
||||
pub hStdOutput: HANDLE,
|
||||
pub hStdError: HANDLE,
|
||||
}
|
||||
pub type LPSTARTUPINFOW = *mut STARTUPINFOW;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct PROCESS_INFORMATION {
|
||||
pub struct PROCESS_INFORMATION {
|
||||
pub hProcess: HANDLE,
|
||||
pub hThread: HANDLE,
|
||||
pub dwProcessId: DWORD,
|
||||
pub dwThreadId: DWORD,
|
||||
}
|
||||
pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct SYSTEM_INFO {
|
||||
pub struct SYSTEM_INFO {
|
||||
pub wProcessorArchitecture: WORD,
|
||||
pub wReserved: WORD,
|
||||
pub dwPageSize: DWORD,
|
||||
@ -297,10 +230,8 @@
|
||||
pub wProcessorLevel: WORD,
|
||||
pub wProcessorRevision: WORD,
|
||||
}
|
||||
pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct MEMORY_BASIC_INFORMATION {
|
||||
pub struct MEMORY_BASIC_INFORMATION {
|
||||
pub BaseAddress: LPVOID,
|
||||
pub AllocationBase: LPVOID,
|
||||
pub AllocationProtect: DWORD,
|
||||
@ -309,10 +240,8 @@
|
||||
pub Protect: DWORD,
|
||||
pub Type: DWORD,
|
||||
}
|
||||
pub type PMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct OVERLAPPED {
|
||||
pub struct OVERLAPPED {
|
||||
pub Internal: *mut c_ulong,
|
||||
pub InternalHigh: *mut c_ulong,
|
||||
pub Offset: DWORD,
|
||||
@ -320,34 +249,24 @@
|
||||
pub hEvent: HANDLE,
|
||||
}
|
||||
|
||||
pub type LPOVERLAPPED = *mut OVERLAPPED;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct FILETIME {
|
||||
pub struct FILETIME {
|
||||
pub dwLowDateTime: DWORD,
|
||||
pub dwHighDateTime: DWORD,
|
||||
}
|
||||
|
||||
pub type LPFILETIME = *mut FILETIME;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct GUID {
|
||||
pub struct GUID {
|
||||
pub Data1: DWORD,
|
||||
pub Data2: WORD,
|
||||
pub Data3: WORD,
|
||||
pub Data4: [BYTE; 8],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)] pub struct WSAPROTOCOLCHAIN {
|
||||
pub struct WSAPROTOCOLCHAIN {
|
||||
pub ChainLen: c_int,
|
||||
pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as usize],
|
||||
}
|
||||
|
||||
pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy)] pub struct WSAPROTOCOL_INFO {
|
||||
pub struct WSAPROTOCOL_INFO {
|
||||
pub dwServiceFlags1: DWORD,
|
||||
pub dwServiceFlags2: DWORD,
|
||||
pub dwServiceFlags3: DWORD,
|
||||
@ -369,16 +288,8 @@
|
||||
pub dwProviderReserved: DWORD,
|
||||
pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1],
|
||||
}
|
||||
impl Clone for WSAPROTOCOL_INFO {
|
||||
fn clone(&self) -> WSAPROTOCOL_INFO { *self }
|
||||
}
|
||||
|
||||
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
|
||||
|
||||
pub type GROUP = c_uint;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy)] pub struct WIN32_FIND_DATAW {
|
||||
pub struct WIN32_FIND_DATAW {
|
||||
pub dwFileAttributes: DWORD,
|
||||
pub ftCreationTime: FILETIME,
|
||||
pub ftLastAccessTime: FILETIME,
|
||||
@ -390,19 +301,8 @@
|
||||
pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
|
||||
pub cAlternateFileName: [wchar_t; 14],
|
||||
}
|
||||
impl Clone for WIN32_FIND_DATAW {
|
||||
fn clone(&self) -> WIN32_FIND_DATAW { *self }
|
||||
}
|
||||
|
||||
pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
|
||||
}
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
pub mod os {
|
||||
pub mod c95 {
|
||||
use types::os::arch::c95::{c_int, c_uint};
|
||||
|
||||
pub const EXIT_FAILURE: c_int = 1;
|
||||
pub const EXIT_SUCCESS: c_int = 0;
|
||||
pub const RAND_MAX: c_int = 32767;
|
||||
@ -479,11 +379,6 @@
|
||||
pub const TMP_MAX: c_uint = 0x7fff_ffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
pub mod c99 {
|
||||
}
|
||||
pub mod posix88 {
|
||||
use types::os::arch::c95::c_int;
|
||||
|
||||
pub const O_RDONLY: c_int = 0;
|
||||
pub const O_WRONLY: c_int = 1;
|
||||
@ -499,13 +394,6 @@
|
||||
pub const S_IEXEC: c_int = 64;
|
||||
pub const S_IWRITE: c_int = 128;
|
||||
pub const S_IREAD: c_int = 256;
|
||||
}
|
||||
pub mod posix01 {
|
||||
}
|
||||
pub mod posix08 {
|
||||
}
|
||||
pub mod bsd44 {
|
||||
use types::os::arch::c95::c_int;
|
||||
|
||||
pub const AF_INET: c_int = 2;
|
||||
pub const AF_INET6: c_int = 23;
|
||||
@ -550,11 +438,6 @@
|
||||
pub const SD_RECEIVE: c_int = 0;
|
||||
pub const SD_SEND: c_int = 1;
|
||||
pub const SD_BOTH: c_int = 2;
|
||||
}
|
||||
pub mod extra {
|
||||
use types::os::common::bsd44::SOCKET;
|
||||
use types::os::arch::c95::{c_int, c_long};
|
||||
use types::os::arch::extra::{WORD, DWORD, BOOL, HANDLE};
|
||||
|
||||
pub const TRUE: BOOL = 1;
|
||||
pub const FALSE: BOOL = 0;
|
||||
@ -781,18 +664,6 @@
|
||||
pub const IPPROTO_RAW: c_int = 255;
|
||||
|
||||
pub const FIONBIO: c_long = -0x7FFB9982;
|
||||
}
|
||||
pub mod sysconf {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub mod posix88 {
|
||||
pub mod stat_ {
|
||||
use types::os::common::posix01::{stat, utimbuf};
|
||||
use types::os::arch::c95::{c_int, c_char, wchar_t};
|
||||
|
||||
extern {
|
||||
#[link_name = "_chmod"]
|
||||
@ -811,48 +682,20 @@
|
||||
pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int;
|
||||
#[link_name = "_wutime64"]
|
||||
pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
pub mod stdio {
|
||||
use types::common::c95::FILE;
|
||||
use types::os::arch::c95::{c_int, c_char};
|
||||
|
||||
extern {
|
||||
#[link_name = "_popen"]
|
||||
pub fn popen(command: *const c_char,
|
||||
mode: *const c_char) -> *mut FILE;
|
||||
pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
|
||||
#[link_name = "_pclose"]
|
||||
pub fn pclose(stream: *mut FILE) -> c_int;
|
||||
pub fn pclose(stream: *mut ::FILE) -> c_int;
|
||||
#[link_name = "_fdopen"]
|
||||
pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
|
||||
pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut ::FILE;
|
||||
#[link_name = "_fileno"]
|
||||
pub fn fileno(stream: *mut FILE) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
pub mod fcntl {
|
||||
use types::os::arch::c95::{c_int, c_char, wchar_t};
|
||||
extern {
|
||||
pub fn fileno(stream: *mut ::FILE) -> c_int;
|
||||
#[link_name = "_open"]
|
||||
pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
|
||||
#[link_name = "_wopen"]
|
||||
pub fn wopen(path: *const wchar_t, oflag: c_int, ...) -> c_int;
|
||||
#[link_name = "_creat"]
|
||||
pub fn creat(path: *const c_char, mode: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
pub mod dirent {
|
||||
// Not supplied at all.
|
||||
}
|
||||
|
||||
pub mod unistd {
|
||||
use types::common::c95::c_void;
|
||||
use types::os::arch::c95::{c_int, c_uint, c_char, c_long};
|
||||
use types::os::arch::c99::intptr_t;
|
||||
|
||||
extern {
|
||||
#[link_name = "_access"]
|
||||
pub fn access(path: *const c_char, amode: c_int) -> c_int;
|
||||
#[link_name = "_chdir"]
|
||||
@ -864,15 +707,12 @@
|
||||
#[link_name = "_dup2"]
|
||||
pub fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
#[link_name = "_execv"]
|
||||
pub fn execv(prog: *const c_char,
|
||||
argv: *const *const c_char) -> intptr_t;
|
||||
pub fn execv(prog: *const c_char, argv: *const *const c_char) -> intptr_t;
|
||||
#[link_name = "_execve"]
|
||||
pub fn execve(prog: *const c_char, argv: *const *const c_char,
|
||||
envp: *const *const c_char)
|
||||
-> c_int;
|
||||
envp: *const *const c_char) -> c_int;
|
||||
#[link_name = "_execvp"]
|
||||
pub fn execvp(c: *const c_char,
|
||||
argv: *const *const c_char) -> c_int;
|
||||
pub fn execvp(c: *const c_char, argv: *const *const c_char) -> c_int;
|
||||
#[link_name = "_execvpe"]
|
||||
pub fn execvpe(c: *const c_char, argv: *const *const c_char,
|
||||
envp: *const *const c_char) -> c_int;
|
||||
@ -883,35 +723,24 @@
|
||||
#[link_name = "_isatty"]
|
||||
pub fn isatty(fd: c_int) -> c_int;
|
||||
#[link_name = "_lseek"]
|
||||
pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
|
||||
-> c_long;
|
||||
pub fn lseek(fd: c_int, offset: c_long, origin: c_int) -> c_long;
|
||||
#[link_name = "_pipe"]
|
||||
pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
|
||||
-> c_int;
|
||||
pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int) -> c_int;
|
||||
#[link_name = "_read"]
|
||||
pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
|
||||
-> c_int;
|
||||
pub fn read(fd: c_int, buf: *mut ::c_void, count: c_uint) -> c_int;
|
||||
#[link_name = "_rmdir"]
|
||||
pub fn rmdir(path: *const c_char) -> c_int;
|
||||
#[link_name = "_unlink"]
|
||||
pub fn unlink(c: *const c_char) -> c_int;
|
||||
#[link_name = "_write"]
|
||||
pub fn write(fd: c_int, buf: *const c_void,
|
||||
count: c_uint) -> c_int;
|
||||
pub fn write(fd: c_int, buf: *const ::c_void, count: c_uint) -> c_int;
|
||||
#[link_name = "_commit"]
|
||||
pub fn commit(fd: c_int) -> c_int;
|
||||
#[link_name = "_get_osfhandle"]
|
||||
pub fn get_osfhandle(fd: c_int) -> intptr_t;
|
||||
#[link_name = "_open_osfhandle"]
|
||||
pub fn open_osfhandle(osfhandle: intptr_t, flags: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
pub mod mman {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub mod extra {
|
||||
|
||||
pub mod kernel32 {
|
||||
use types::os::arch::c95::{c_uint};
|
||||
use types::os::arch::extra::*;
|
||||
|
||||
extern "system" {
|
||||
pub fn GetEnvironmentVariableW(n: LPCWSTR,
|
||||
@ -1049,13 +878,11 @@
|
||||
dwMoveMethod: DWORD) -> BOOL;
|
||||
pub fn SetEndOfFile(hFile: HANDLE) -> BOOL;
|
||||
|
||||
pub fn GetSystemTimeAsFileTime(
|
||||
lpSystemTimeAsFileTime: LPFILETIME);
|
||||
pub fn GetSystemTimeAsFileTime(lpSystemTimeAsFileTime: LPFILETIME);
|
||||
|
||||
pub fn QueryPerformanceFrequency(
|
||||
lpFrequency: *mut LARGE_INTEGER) -> BOOL;
|
||||
pub fn QueryPerformanceCounter(
|
||||
lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
|
||||
pub fn QueryPerformanceFrequency(lpFrequency: *mut LARGE_INTEGER) -> BOOL;
|
||||
pub fn QueryPerformanceCounter(lpPerformanceCount: *mut LARGE_INTEGER)
|
||||
-> BOOL;
|
||||
|
||||
pub fn GetCurrentProcessId() -> DWORD;
|
||||
pub fn CreateNamedPipeW(
|
||||
@ -1086,42 +913,8 @@
|
||||
lpNumberOfBytesTransferred: LPDWORD,
|
||||
bWait: BOOL) -> BOOL;
|
||||
pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL;
|
||||
}
|
||||
}
|
||||
|
||||
pub mod msvcrt {
|
||||
use types::os::arch::c95::c_int;
|
||||
use types::os::arch::c99::intptr_t;
|
||||
|
||||
extern {
|
||||
#[link_name = "_commit"]
|
||||
pub fn commit(fd: c_int) -> c_int;
|
||||
|
||||
#[link_name = "_get_osfhandle"]
|
||||
pub fn get_osfhandle(fd: c_int) -> intptr_t;
|
||||
|
||||
#[link_name = "_open_osfhandle"]
|
||||
pub fn open_osfhandle(osfhandle: intptr_t,
|
||||
flags: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
pub mod winsock {
|
||||
use types::os::arch::c95::{c_int, c_long, c_ulong};
|
||||
use types::os::common::bsd44::SOCKET;
|
||||
|
||||
extern "system" {
|
||||
pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub mod bsd43 {
|
||||
use types::os::common::bsd44::{sockaddr, SOCKET};
|
||||
use types::os::arch::c95::{c_int, c_char};
|
||||
|
||||
extern "system" {
|
||||
pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
|
||||
pub fn connect(socket: SOCKET, address: *const sockaddr,
|
||||
len: c_int) -> c_int;
|
||||
@ -1150,4 +943,3 @@
|
||||
addrlen: c_int) -> c_int;
|
||||
pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user