blob: 90b04919c68c87e6acb28242ad88368ca07c523e [file] [log] [blame]
Alex Crichton5d6cf052015-09-11 14:52:34 -07001
2
3 #[cfg(target_os = "windows")]
4 pub mod os {
5 pub mod common {
6 pub mod posix01 {
7 use types::os::arch::c95::{c_short, time_t, c_long};
8 use types::os::arch::extra::{time64_t};
9 use types::os::arch::posix88::{dev_t, ino_t};
10
11 // pub Note: this is the struct called stat64 in Windows. Not
12 // stat, nor stati64.
13 #[repr(C)]
14 #[derive(Copy, Clone)] pub struct stat {
15 pub st_dev: dev_t,
16 pub st_ino: ino_t,
17 pub st_mode: u16,
18 pub st_nlink: c_short,
19 pub st_uid: c_short,
20 pub st_gid: c_short,
21 pub st_rdev: dev_t,
22 pub st_size: i64,
23 pub st_atime: time64_t,
24 pub st_mtime: time64_t,
25 pub st_ctime: time64_t,
26 }
27
28 // note that this is called utimbuf64 in Windows
29 #[repr(C)]
30 #[derive(Copy, Clone)] pub struct utimbuf {
31 pub actime: time64_t,
32 pub modtime: time64_t,
33 }
34
35 #[repr(C)]
36 #[derive(Copy, Clone)] pub struct timeval {
37 pub tv_sec: c_long,
38 pub tv_usec: c_long,
39 }
40
41 #[repr(C)]
42 #[derive(Copy, Clone)] pub struct timespec {
43 pub tv_sec: time_t,
44 pub tv_nsec: c_long,
45 }
46
47 pub enum timezone {}
48 }
49
50 pub mod bsd44 {
51 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
52 use types::os::arch::c99::uintptr_t;
53
54 pub type SOCKET = uintptr_t;
55 #[repr(C)]
56 #[derive(Copy, Clone)] pub struct sockaddr {
57 pub sa_family: u16,
58 pub sa_data: [u8; 14],
59 }
60 #[repr(C)]
61 #[derive(Copy)] pub struct sockaddr_storage {
62 pub ss_family: u16,
63 __ss_pad1: [u8; 6],
64 __ss_align: i64,
65 __ss_pad2: [u8; 112],
66 }
67 impl Clone for sockaddr_storage {
68 fn clone(&self) -> sockaddr_storage { *self }
69 }
70 #[repr(C)]
71 #[derive(Copy, Clone)] pub struct sockaddr_in {
72 pub sin_family: u16,
73 pub sin_port: u16,
74 pub sin_addr: in_addr,
75 pub sin_zero: [u8; 8],
76 }
77 #[repr(C)]
78 #[derive(Copy, Clone)] pub struct in_addr {
79 pub s_addr: u32,
80 }
81 #[repr(C)]
82 #[derive(Copy, Clone)] pub struct sockaddr_in6 {
83 pub sin6_family: u16,
84 pub sin6_port: u16,
85 pub sin6_flowinfo: u32,
86 pub sin6_addr: in6_addr,
87 pub sin6_scope_id: u32,
88 }
89 #[repr(C)]
90 #[derive(Copy, Clone)] pub struct in6_addr {
91 pub s6_addr: [u16; 8],
92 }
93 #[repr(C)]
94 #[derive(Copy, Clone)] pub struct ip_mreq {
95 pub imr_multiaddr: in_addr,
96 pub imr_interface: in_addr,
97 }
98 #[repr(C)]
99 #[derive(Copy, Clone)] pub struct ipv6_mreq {
100 pub ipv6mr_multiaddr: in6_addr,
101 pub ipv6mr_interface: c_uint,
102 }
103 #[repr(C)]
104 #[derive(Copy, Clone)] pub struct addrinfo {
105 pub ai_flags: c_int,
106 pub ai_family: c_int,
107 pub ai_socktype: c_int,
108 pub ai_protocol: c_int,
109 pub ai_addrlen: size_t,
110 pub ai_canonname: *mut c_char,
111 pub ai_addr: *mut sockaddr,
112 pub ai_next: *mut addrinfo,
113 }
114 }
115 }
116
117 pub mod arch {
118 pub mod c95 {
119 pub type c_char = i8;
120 pub type c_schar = i8;
121 pub type c_uchar = u8;
122 pub type c_short = i16;
123 pub type c_ushort = u16;
124 pub type c_int = i32;
125 pub type c_uint = u32;
126 pub type c_long = i32;
127 pub type c_ulong = u32;
128 pub type c_float = f32;
129 pub type c_double = f64;
130
131 #[cfg(target_arch = "x86")]
132 pub type size_t = u32;
133 #[cfg(target_arch = "x86_64")]
134 pub type size_t = u64;
135
136 #[cfg(target_arch = "x86")]
137 pub type ptrdiff_t = i32;
138 #[cfg(target_arch = "x86_64")]
139 pub type ptrdiff_t = i64;
140
141 pub type clock_t = i32;
142
143 cfg_if! {
144 if #[cfg(all(target_arch = "x86", target_env = "gnu"))] {
145 pub type time_t = i32;
146 } else {
147 pub type time_t = i64;
148 }
149 }
150
151 pub type wchar_t = u16;
152 }
153
154 pub mod c99 {
155 pub type c_longlong = i64;
156 pub type c_ulonglong = u64;
157
158 #[cfg(target_arch = "x86")]
159 pub type intptr_t = i32;
160 #[cfg(target_arch = "x86_64")]
161 pub type intptr_t = i64;
162
163 #[cfg(target_arch = "x86")]
164 pub type uintptr_t = u32;
165 #[cfg(target_arch = "x86_64")]
166 pub type uintptr_t = u64;
167
168 pub type intmax_t = i64;
169 pub type uintmax_t = u64;
170 }
171
172 pub mod posix88 {
173 pub type off_t = i32;
174 pub type dev_t = u32;
175 pub type ino_t = u16;
176
177 #[cfg(target_arch = "x86")]
178 pub type ssize_t = i32;
179 #[cfg(target_arch = "x86_64")]
180 pub type ssize_t = i64;
181 }
182
183 pub mod posix01 {
184 }
185 pub mod posix08 {
186 }
187 pub mod bsd44 {
188 }
189 pub mod extra {
190 use consts::os::extra::{MAX_PROTOCOL_CHAIN,
191 WSAPROTOCOL_LEN};
192 use types::common::c95::c_void;
193 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
194 use types::os::arch::c95::{c_long, c_ulong};
195 use types::os::arch::c95::{wchar_t};
196 use types::os::arch::c99::{c_ulonglong, c_longlong, uintptr_t};
197
198 pub type BOOL = c_int;
199 pub type BYTE = u8;
200 pub type BOOLEAN = BYTE;
201 pub type CCHAR = c_char;
202 pub type CHAR = c_char;
203
204 pub type DWORD = c_ulong;
205 pub type DWORDLONG = c_ulonglong;
206
207 pub type HANDLE = LPVOID;
208 pub type HINSTANCE = HANDLE;
209 pub type HMODULE = HINSTANCE;
210
211 pub type LONG = c_long;
212 pub type PLONG = *mut c_long;
213
214 #[cfg(target_arch = "x86")]
215 pub type LONG_PTR = c_long;
216 #[cfg(target_arch = "x86_64")]
217 pub type LONG_PTR = i64;
218
219 pub type LARGE_INTEGER = c_longlong;
220 pub type PLARGE_INTEGER = *mut c_longlong;
221
222 pub type LPCWSTR = *const WCHAR;
223 pub type LPCSTR = *const CHAR;
224
225 pub type LPWSTR = *mut WCHAR;
226 pub type LPSTR = *mut CHAR;
227
228 pub type LPWCH = *mut WCHAR;
229 pub type LPCH = *mut CHAR;
230
231 #[repr(C)]
232 #[derive(Copy, Clone)] pub struct SECURITY_ATTRIBUTES {
233 pub nLength: DWORD,
234 pub lpSecurityDescriptor: LPVOID,
235 pub bInheritHandle: BOOL,
236 }
237 pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES;
238
239 pub type LPVOID = *mut c_void;
240 pub type LPCVOID = *const c_void;
241 pub type LPBYTE = *mut BYTE;
242 pub type LPWORD = *mut WORD;
243 pub type LPDWORD = *mut DWORD;
244 pub type LPHANDLE = *mut HANDLE;
245
246 pub type LRESULT = LONG_PTR;
247 pub type PBOOL = *mut BOOL;
248 pub type WCHAR = wchar_t;
249 pub type WORD = u16;
250 pub type SIZE_T = size_t;
251
252 pub type time64_t = i64;
253
254 #[repr(C)]
255 #[derive(Copy, Clone)] pub struct STARTUPINFOW {
256 pub cb: DWORD,
257 pub lpReserved: LPWSTR,
258 pub lpDesktop: LPWSTR,
259 pub lpTitle: LPWSTR,
260 pub dwX: DWORD,
261 pub dwY: DWORD,
262 pub dwXSize: DWORD,
263 pub dwYSize: DWORD,
264 pub dwXCountChars: DWORD,
265 pub dwYCountChars: DWORD,
266 pub dwFillAttribute: DWORD,
267 pub dwFlags: DWORD,
268 pub wShowWindow: WORD,
269 pub cbReserved2: WORD,
270 pub lpReserved2: LPBYTE,
271 pub hStdInput: HANDLE,
272 pub hStdOutput: HANDLE,
273 pub hStdError: HANDLE,
274 }
275 pub type LPSTARTUPINFOW = *mut STARTUPINFOW;
276
277 #[repr(C)]
278 #[derive(Copy, Clone)] pub struct PROCESS_INFORMATION {
279 pub hProcess: HANDLE,
280 pub hThread: HANDLE,
281 pub dwProcessId: DWORD,
282 pub dwThreadId: DWORD,
283 }
284 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
285
286 #[repr(C)]
287 #[derive(Copy, Clone)] pub struct SYSTEM_INFO {
288 pub wProcessorArchitecture: WORD,
289 pub wReserved: WORD,
290 pub dwPageSize: DWORD,
291 pub lpMinimumApplicationAddress: LPVOID,
292 pub lpMaximumApplicationAddress: LPVOID,
293 pub dwActiveProcessorMask: uintptr_t,
294 pub dwNumberOfProcessors: DWORD,
295 pub dwProcessorType: DWORD,
296 pub dwAllocationGranularity: DWORD,
297 pub wProcessorLevel: WORD,
298 pub wProcessorRevision: WORD,
299 }
300 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
301
302 #[repr(C)]
303 #[derive(Copy, Clone)] pub struct MEMORY_BASIC_INFORMATION {
304 pub BaseAddress: LPVOID,
305 pub AllocationBase: LPVOID,
306 pub AllocationProtect: DWORD,
307 pub RegionSize: SIZE_T,
308 pub State: DWORD,
309 pub Protect: DWORD,
310 pub Type: DWORD,
311 }
312 pub type PMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
313
314 #[repr(C)]
315 #[derive(Copy, Clone)] pub struct OVERLAPPED {
316 pub Internal: *mut c_ulong,
317 pub InternalHigh: *mut c_ulong,
318 pub Offset: DWORD,
319 pub OffsetHigh: DWORD,
320 pub hEvent: HANDLE,
321 }
322
323 pub type LPOVERLAPPED = *mut OVERLAPPED;
324
325 #[repr(C)]
326 #[derive(Copy, Clone)] pub struct FILETIME {
327 pub dwLowDateTime: DWORD,
328 pub dwHighDateTime: DWORD,
329 }
330
331 pub type LPFILETIME = *mut FILETIME;
332
333 #[repr(C)]
334 #[derive(Copy, Clone)] pub struct GUID {
335 pub Data1: DWORD,
336 pub Data2: WORD,
337 pub Data3: WORD,
338 pub Data4: [BYTE; 8],
339 }
340
341 #[repr(C)]
342 #[derive(Copy, Clone)] pub struct WSAPROTOCOLCHAIN {
343 pub ChainLen: c_int,
344 pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as usize],
345 }
346
347 pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
348
349 #[repr(C)]
350 #[derive(Copy)] pub struct WSAPROTOCOL_INFO {
351 pub dwServiceFlags1: DWORD,
352 pub dwServiceFlags2: DWORD,
353 pub dwServiceFlags3: DWORD,
354 pub dwServiceFlags4: DWORD,
355 pub dwProviderFlags: DWORD,
356 pub ProviderId: GUID,
357 pub dwCatalogEntryId: DWORD,
358 pub ProtocolChain: WSAPROTOCOLCHAIN,
359 pub iVersion: c_int,
360 pub iAddressFamily: c_int,
361 pub iMaxSockAddr: c_int,
362 pub iMinSockAddr: c_int,
363 pub iSocketType: c_int,
364 pub iProtocol: c_int,
365 pub iProtocolMaxOffset: c_int,
366 pub iNetworkByteOrder: c_int,
367 pub iSecurityScheme: c_int,
368 pub dwMessageSize: DWORD,
369 pub dwProviderReserved: DWORD,
370 pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1],
371 }
372 impl Clone for WSAPROTOCOL_INFO {
373 fn clone(&self) -> WSAPROTOCOL_INFO { *self }
374 }
375
376 pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
377
378 pub type GROUP = c_uint;
379
380 #[repr(C)]
381 #[derive(Copy)] pub struct WIN32_FIND_DATAW {
382 pub dwFileAttributes: DWORD,
383 pub ftCreationTime: FILETIME,
384 pub ftLastAccessTime: FILETIME,
385 pub ftLastWriteTime: FILETIME,
386 pub nFileSizeHigh: DWORD,
387 pub nFileSizeLow: DWORD,
388 pub dwReserved0: DWORD,
389 pub dwReserved1: DWORD,
390 pub cFileName: [wchar_t; 260], // #define MAX_PATH 260
391 pub cAlternateFileName: [wchar_t; 14],
392 }
393 impl Clone for WIN32_FIND_DATAW {
394 fn clone(&self) -> WIN32_FIND_DATAW { *self }
395 }
396
397 pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW;
398 }
399 }
400 }
401 #[cfg(target_os = "windows")]
402 pub mod os {
403 pub mod c95 {
404 use types::os::arch::c95::{c_int, c_uint};
405
406 pub const EXIT_FAILURE : c_int = 1;
407 pub const EXIT_SUCCESS : c_int = 0;
408 pub const RAND_MAX : c_int = 32767;
409 pub const EOF : c_int = -1;
410 pub const SEEK_SET : c_int = 0;
411 pub const SEEK_CUR : c_int = 1;
412 pub const SEEK_END : c_int = 2;
413 pub const _IOFBF : c_int = 0;
414 pub const _IONBF : c_int = 4;
415 pub const _IOLBF : c_int = 64;
416 pub const BUFSIZ : c_uint = 512;
417 pub const FOPEN_MAX : c_uint = 20;
418 pub const FILENAME_MAX : c_uint = 260;
419
420 pub const WSAEINTR: c_int = 10004;
421 pub const WSAEBADF: c_int = 10009;
422 pub const WSAEACCES: c_int = 10013;
423 pub const WSAEFAULT: c_int = 10014;
424 pub const WSAEINVAL: c_int = 10022;
425 pub const WSAEMFILE: c_int = 10024;
426 pub const WSAEWOULDBLOCK: c_int = 10035;
427 pub const WSAEINPROGRESS: c_int = 10036;
428 pub const WSAEALREADY: c_int = 10037;
429 pub const WSAENOTSOCK: c_int = 10038;
430 pub const WSAEDESTADDRREQ: c_int = 10039;
431 pub const WSAEMSGSIZE: c_int = 10040;
432 pub const WSAEPROTOTYPE: c_int = 10041;
433 pub const WSAENOPROTOOPT: c_int = 10042;
434 pub const WSAEPROTONOSUPPORT: c_int = 10043;
435 pub const WSAESOCKTNOSUPPORT: c_int = 10044;
436 pub const WSAEOPNOTSUPP: c_int = 10045;
437 pub const WSAEPFNOSUPPORT: c_int = 10046;
438 pub const WSAEAFNOSUPPORT: c_int = 10047;
439 pub const WSAEADDRINUSE: c_int = 10048;
440 pub const WSAEADDRNOTAVAIL: c_int = 10049;
441 pub const WSAENETDOWN: c_int = 10050;
442 pub const WSAENETUNREACH: c_int = 10051;
443 pub const WSAENETRESET: c_int = 10052;
444 pub const WSAECONNABORTED: c_int = 10053;
445 pub const WSAECONNRESET: c_int = 10054;
446 pub const WSAENOBUFS: c_int = 10055;
447 pub const WSAEISCONN: c_int = 10056;
448 pub const WSAENOTCONN: c_int = 10057;
449 pub const WSAESHUTDOWN: c_int = 10058;
450 pub const WSAETOOMANYREFS: c_int = 10059;
451 pub const WSAETIMEDOUT: c_int = 10060;
452 pub const WSAECONNREFUSED: c_int = 10061;
453 pub const WSAELOOP: c_int = 10062;
454 pub const WSAENAMETOOLONG: c_int = 10063;
455 pub const WSAEHOSTDOWN: c_int = 10064;
456 pub const WSAEHOSTUNREACH: c_int = 10065;
457 pub const WSAENOTEMPTY: c_int = 10066;
458 pub const WSAEPROCLIM: c_int = 10067;
459 pub const WSAEUSERS: c_int = 10068;
460 pub const WSAEDQUOT: c_int = 10069;
461 pub const WSAESTALE: c_int = 10070;
462 pub const WSAEREMOTE: c_int = 10071;
463 pub const WSASYSNOTREADY: c_int = 10091;
464 pub const WSAVERNOTSUPPORTED: c_int = 10092;
465 pub const WSANOTINITIALISED: c_int = 10093;
466 pub const WSAEDISCON: c_int = 10101;
467 pub const WSAENOMORE: c_int = 10102;
468 pub const WSAECANCELLED: c_int = 10103;
469 pub const WSAEINVALIDPROCTABLE: c_int = 10104;
470 pub const WSAEINVALIDPROVIDER: c_int = 10105;
471 pub const WSAEPROVIDERFAILEDINIT: c_int = 10106;
472
473 cfg_if! {
474 if #[cfg(all(target_env = "gnu"))] {
475 pub const L_tmpnam : c_uint = 14;
476 pub const TMP_MAX : c_uint = 0x7fff;
477 } else {
478 pub const L_tmpnam : c_uint = 260;
479 pub const TMP_MAX : c_uint = 0x7fff_ffff;
480 }
481 }
482 }
483 pub mod c99 {
484 }
485 pub mod posix88 {
486 use types::os::arch::c95::c_int;
487
488 pub const O_RDONLY : c_int = 0;
489 pub const O_WRONLY : c_int = 1;
490 pub const O_RDWR : c_int = 2;
491 pub const O_APPEND : c_int = 8;
492 pub const O_CREAT : c_int = 256;
493 pub const O_EXCL : c_int = 1024;
494 pub const O_TRUNC : c_int = 512;
495 pub const S_IFCHR : c_int = 8192;
496 pub const S_IFDIR : c_int = 16384;
497 pub const S_IFREG : c_int = 32768;
498 pub const S_IFMT : c_int = 61440;
499 pub const S_IEXEC : c_int = 64;
500 pub const S_IWRITE : c_int = 128;
501 pub const S_IREAD : c_int = 256;
502 }
503 pub mod posix01 {
504 }
505 pub mod posix08 {
506 }
507 pub mod bsd44 {
508 use types::os::arch::c95::c_int;
509
510 pub const AF_INET: c_int = 2;
511 pub const AF_INET6: c_int = 23;
512 pub const SOCK_STREAM: c_int = 1;
513 pub const SOCK_DGRAM: c_int = 2;
514 pub const SOCK_RAW: c_int = 3;
515 pub const IPPROTO_TCP: c_int = 6;
516 pub const IPPROTO_IP: c_int = 0;
517 pub const IPPROTO_IPV6: c_int = 41;
518 pub const IP_MULTICAST_TTL: c_int = 10;
519 pub const IP_MULTICAST_LOOP: c_int = 11;
520 pub const IP_ADD_MEMBERSHIP: c_int = 12;
521 pub const IP_DROP_MEMBERSHIP: c_int = 13;
522 pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
523 pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
524 pub const IP_TTL: c_int = 4;
525 pub const IP_HDRINCL: c_int = 2;
526
527 pub const TCP_NODELAY: c_int = 0x0001;
528 pub const SOL_SOCKET: c_int = 0xffff;
529
530 pub const SO_DEBUG: c_int = 0x0001;
531 pub const SO_ACCEPTCONN: c_int = 0x0002;
532 pub const SO_REUSEADDR: c_int = 0x0004;
533 pub const SO_KEEPALIVE: c_int = 0x0008;
534 pub const SO_DONTROUTE: c_int = 0x0010;
535 pub const SO_BROADCAST: c_int = 0x0020;
536 pub const SO_USELOOPBACK: c_int = 0x0040;
537 pub const SO_LINGER: c_int = 0x0080;
538 pub const SO_OOBINLINE: c_int = 0x0100;
539 pub const SO_SNDBUF: c_int = 0x1001;
540 pub const SO_RCVBUF: c_int = 0x1002;
541 pub const SO_SNDLOWAT: c_int = 0x1003;
542 pub const SO_RCVLOWAT: c_int = 0x1004;
543 pub const SO_SNDTIMEO: c_int = 0x1005;
544 pub const SO_RCVTIMEO: c_int = 0x1006;
545 pub const SO_ERROR: c_int = 0x1007;
546 pub const SO_TYPE: c_int = 0x1008;
547
548 pub const IFF_LOOPBACK: c_int = 4;
549
550 pub const SD_RECEIVE: c_int = 0;
551 pub const SD_SEND: c_int = 1;
552 pub const SD_BOTH: c_int = 2;
553 }
554 pub mod extra {
555 use types::os::common::bsd44::SOCKET;
556 use types::os::arch::c95::{c_int, c_long};
557 use types::os::arch::extra::{WORD, DWORD, BOOL, HANDLE};
558
559 pub const TRUE : BOOL = 1;
560 pub const FALSE : BOOL = 0;
561
562 pub const O_TEXT : c_int = 16384;
563 pub const O_BINARY : c_int = 32768;
564 pub const O_NOINHERIT: c_int = 128;
565
566 pub const ERROR_SUCCESS : c_int = 0;
567 pub const ERROR_INVALID_FUNCTION: c_int = 1;
568 pub const ERROR_FILE_NOT_FOUND: c_int = 2;
569 pub const ERROR_ACCESS_DENIED: c_int = 5;
570 pub const ERROR_INVALID_HANDLE : c_int = 6;
571 pub const ERROR_BROKEN_PIPE: c_int = 109;
572 pub const ERROR_DISK_FULL : c_int = 112;
573 pub const ERROR_CALL_NOT_IMPLEMENTED : c_int = 120;
574 pub const ERROR_INSUFFICIENT_BUFFER : c_int = 122;
575 pub const ERROR_INVALID_NAME : c_int = 123;
576 pub const ERROR_ALREADY_EXISTS : c_int = 183;
577 pub const ERROR_PIPE_BUSY: c_int = 231;
578 pub const ERROR_NO_DATA: c_int = 232;
579 pub const ERROR_INVALID_ADDRESS : c_int = 487;
580 pub const ERROR_PIPE_CONNECTED: c_int = 535;
581 pub const ERROR_NOTHING_TO_TERMINATE: c_int = 758;
582 pub const ERROR_OPERATION_ABORTED: c_int = 995;
583 pub const ERROR_IO_PENDING: c_int = 997;
584 pub const ERROR_FILE_INVALID : c_int = 1006;
585 pub const ERROR_NOT_FOUND: c_int = 1168;
586 pub const INVALID_HANDLE_VALUE: HANDLE = !0 as HANDLE;
587
588 pub const DELETE : DWORD = 0x00010000;
589 pub const READ_CONTROL : DWORD = 0x00020000;
590 pub const SYNCHRONIZE : DWORD = 0x00100000;
591 pub const WRITE_DAC : DWORD = 0x00040000;
592 pub const WRITE_OWNER : DWORD = 0x00080000;
593
594 pub const PROCESS_CREATE_PROCESS : DWORD = 0x0080;
595 pub const PROCESS_CREATE_THREAD : DWORD = 0x0002;
596 pub const PROCESS_DUP_HANDLE : DWORD = 0x0040;
597 pub const PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
598 pub const PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
599 pub const PROCESS_SET_INFORMATION : DWORD = 0x0200;
600 pub const PROCESS_SET_QUOTA : DWORD = 0x0100;
601 pub const PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
602 pub const PROCESS_TERMINATE : DWORD = 0x0001;
603 pub const PROCESS_VM_OPERATION : DWORD = 0x0008;
604 pub const PROCESS_VM_READ : DWORD = 0x0010;
605 pub const PROCESS_VM_WRITE : DWORD = 0x0020;
606
607 pub const STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
608 pub const STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
609 pub const STARTF_PREVENTPINNING : DWORD = 0x00002000;
610 pub const STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
611 pub const STARTF_TITLEISAPPID : DWORD = 0x00001000;
612 pub const STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
613 pub const STARTF_USECOUNTCHARS : DWORD = 0x00000008;
614 pub const STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
615 pub const STARTF_USEHOTKEY : DWORD = 0x00000200;
616 pub const STARTF_USEPOSITION : DWORD = 0x00000004;
617 pub const STARTF_USESHOWWINDOW : DWORD = 0x00000001;
618 pub const STARTF_USESIZE : DWORD = 0x00000002;
619 pub const STARTF_USESTDHANDLES : DWORD = 0x00000100;
620
621 pub const WAIT_ABANDONED : DWORD = 0x00000080;
622 pub const WAIT_OBJECT_0 : DWORD = 0x00000000;
623 pub const WAIT_TIMEOUT : DWORD = 0x00000102;
624 pub const WAIT_FAILED : DWORD = !0;
625
626 pub const DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
627 pub const DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;
628
629 pub const INFINITE : DWORD = !0;
630 pub const STILL_ACTIVE : DWORD = 259;
631
632 pub const MEM_COMMIT : DWORD = 0x00001000;
633 pub const MEM_RESERVE : DWORD = 0x00002000;
634 pub const MEM_DECOMMIT : DWORD = 0x00004000;
635 pub const MEM_RELEASE : DWORD = 0x00008000;
636 pub const MEM_RESET : DWORD = 0x00080000;
637 pub const MEM_RESET_UNDO : DWORD = 0x1000000;
638 pub const MEM_LARGE_PAGES : DWORD = 0x20000000;
639 pub const MEM_PHYSICAL : DWORD = 0x00400000;
640 pub const MEM_TOP_DOWN : DWORD = 0x00100000;
641 pub const MEM_WRITE_WATCH : DWORD = 0x00200000;
642
643 pub const PAGE_EXECUTE : DWORD = 0x10;
644 pub const PAGE_EXECUTE_READ : DWORD = 0x20;
645 pub const PAGE_EXECUTE_READWRITE : DWORD = 0x40;
646 pub const PAGE_EXECUTE_WRITECOPY : DWORD = 0x80;
647 pub const PAGE_NOACCESS : DWORD = 0x01;
648 pub const PAGE_READONLY : DWORD = 0x02;
649 pub const PAGE_READWRITE : DWORD = 0x04;
650 pub const PAGE_WRITECOPY : DWORD = 0x08;
651 pub const PAGE_GUARD : DWORD = 0x100;
652 pub const PAGE_NOCACHE : DWORD = 0x200;
653 pub const PAGE_WRITECOMBINE : DWORD = 0x400;
654
655 pub const SEC_COMMIT : DWORD = 0x8000000;
656 pub const SEC_IMAGE : DWORD = 0x1000000;
657 pub const SEC_IMAGE_NO_EXECUTE : DWORD = 0x11000000;
658 pub const SEC_LARGE_PAGES : DWORD = 0x80000000;
659 pub const SEC_NOCACHE : DWORD = 0x10000000;
660 pub const SEC_RESERVE : DWORD = 0x4000000;
661 pub const SEC_WRITECOMBINE : DWORD = 0x40000000;
662
663 pub const FILE_MAP_ALL_ACCESS : DWORD = 0xf001f;
664 pub const FILE_MAP_READ : DWORD = 0x4;
665 pub const FILE_MAP_WRITE : DWORD = 0x2;
666 pub const FILE_MAP_COPY : DWORD = 0x1;
667 pub const FILE_MAP_EXECUTE : DWORD = 0x20;
668
669 pub const PROCESSOR_ARCHITECTURE_INTEL : WORD = 0;
670 pub const PROCESSOR_ARCHITECTURE_ARM : WORD = 5;
671 pub const PROCESSOR_ARCHITECTURE_IA64 : WORD = 6;
672 pub const PROCESSOR_ARCHITECTURE_AMD64 : WORD = 9;
673 pub const PROCESSOR_ARCHITECTURE_UNKNOWN : WORD = 0xffff;
674
675 pub const MOVEFILE_COPY_ALLOWED: DWORD = 2;
676 pub const MOVEFILE_CREATE_HARDLINK: DWORD = 16;
677 pub const MOVEFILE_DELAY_UNTIL_REBOOT: DWORD = 4;
678 pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: DWORD = 32;
679 pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1;
680 pub const MOVEFILE_WRITE_THROUGH: DWORD = 8;
681
682 pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 1;
683
684 pub const FILE_SHARE_DELETE: DWORD = 0x4;
685 pub const FILE_SHARE_READ: DWORD = 0x1;
686 pub const FILE_SHARE_WRITE: DWORD = 0x2;
687
688 pub const CREATE_ALWAYS: DWORD = 2;
689 pub const CREATE_NEW: DWORD = 1;
690 pub const OPEN_ALWAYS: DWORD = 4;
691 pub const OPEN_EXISTING: DWORD = 3;
692 pub const TRUNCATE_EXISTING: DWORD = 5;
693
694 pub const FILE_APPEND_DATA: DWORD = 0x00000004;
695 pub const FILE_READ_DATA: DWORD = 0x00000001;
696 pub const FILE_WRITE_DATA: DWORD = 0x00000002;
697
698 pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x20;
699 pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x800;
700 pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x40;
701 pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10;
702 pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x4000;
703 pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x2;
704 pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x8000;
705 pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x80;
706 pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x2000;
707 pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x20000;
708 pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x1000;
709 pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1;
710 pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400;
711 pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x200;
712 pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x4;
713 pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x100;
714 pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x10000;
715
716 pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000;
717 pub const FILE_FLAG_DELETE_ON_CLOSE: DWORD = 0x04000000;
718 pub const FILE_FLAG_NO_BUFFERING: DWORD = 0x20000000;
719 pub const FILE_FLAG_OPEN_NO_RECALL: DWORD = 0x00100000;
720 pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000;
721 pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000;
722 pub const FILE_FLAG_POSIX_SEMANTICS: DWORD = 0x1000000;
723 pub const FILE_FLAG_RANDOM_ACCESS: DWORD = 0x10000000;
724 pub const FILE_FLAG_SESSION_AWARE: DWORD = 0x00800000;
725 pub const FILE_FLAG_SEQUENTIAL_SCAN: DWORD = 0x08000000;
726 pub const FILE_FLAG_WRITE_THROUGH: DWORD = 0x80000000;
727 pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000;
728
729 pub const FILE_NAME_NORMALIZED: DWORD = 0x0;
730 pub const FILE_NAME_OPENED: DWORD = 0x8;
731
732 pub const VOLUME_NAME_DOS: DWORD = 0x0;
733 pub const VOLUME_NAME_GUID: DWORD = 0x1;
734 pub const VOLUME_NAME_NONE: DWORD = 0x4;
735 pub const VOLUME_NAME_NT: DWORD = 0x2;
736
737 pub const GENERIC_READ: DWORD = 0x80000000;
738 pub const GENERIC_WRITE: DWORD = 0x40000000;
739 pub const GENERIC_EXECUTE: DWORD = 0x20000000;
740 pub const GENERIC_ALL: DWORD = 0x10000000;
741 pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100;
742 pub const FILE_READ_ATTRIBUTES: DWORD = 0x00000080;
743
744 pub const STANDARD_RIGHTS_READ: DWORD = 0x20000;
745 pub const STANDARD_RIGHTS_WRITE: DWORD = 0x20000;
746 pub const FILE_WRITE_EA: DWORD = 0x00000010;
747 pub const FILE_READ_EA: DWORD = 0x00000008;
748 pub const FILE_GENERIC_READ: DWORD =
749 STANDARD_RIGHTS_READ | FILE_READ_DATA |
750 FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
751 pub const FILE_GENERIC_WRITE: DWORD =
752 STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA |
753 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA |
754 SYNCHRONIZE;
755
756 pub const FILE_BEGIN: DWORD = 0;
757 pub const FILE_CURRENT: DWORD = 1;
758 pub const FILE_END: DWORD = 2;
759
760 pub const MAX_PROTOCOL_CHAIN: DWORD = 7;
761 pub const WSAPROTOCOL_LEN: DWORD = 255;
762 pub const INVALID_SOCKET: SOCKET = !0;
763
764 pub const DETACHED_PROCESS: DWORD = 0x00000008;
765 pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200;
766 pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400;
767
768 pub const PIPE_ACCESS_DUPLEX: DWORD = 0x00000003;
769 pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001;
770 pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002;
771 pub const PIPE_TYPE_BYTE: DWORD = 0x00000000;
772 pub const PIPE_TYPE_MESSAGE: DWORD = 0x00000004;
773 pub const PIPE_READMODE_BYTE: DWORD = 0x00000000;
774 pub const PIPE_READMODE_MESSAGE: DWORD = 0x00000002;
775 pub const PIPE_WAIT: DWORD = 0x00000000;
776 pub const PIPE_NOWAIT: DWORD = 0x00000001;
777 pub const PIPE_ACCEPT_REMOTE_CLIENTS: DWORD = 0x00000000;
778 pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008;
779 pub const PIPE_UNLIMITED_INSTANCES: DWORD = 255;
780
781 pub const IPPROTO_RAW: c_int = 255;
782
783 pub const FIONBIO: c_long = -0x7FFB9982;
784 }
785 pub mod sysconf {
786 }
787 }
788
789
790
791 #[cfg(target_os = "windows")]
792 pub mod posix88 {
793 pub mod stat_ {
794 use types::os::common::posix01::{stat, utimbuf};
795 use types::os::arch::c95::{c_int, c_char, wchar_t};
796
797 extern {
798 #[link_name = "_chmod"]
799 pub fn chmod(path: *const c_char, mode: c_int) -> c_int;
800 #[link_name = "_wchmod"]
801 pub fn wchmod(path: *const wchar_t, mode: c_int) -> c_int;
802 #[link_name = "_mkdir"]
803 pub fn mkdir(path: *const c_char) -> c_int;
804 #[link_name = "_wrmdir"]
805 pub fn wrmdir(path: *const wchar_t) -> c_int;
806 #[link_name = "_fstat64"]
807 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
808 #[link_name = "_stat64"]
809 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
810 #[link_name = "_wstat64"]
811 pub fn wstat(path: *const wchar_t, buf: *mut stat) -> c_int;
812 #[link_name = "_wutime64"]
813 pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> c_int;
814 }
815 }
816
817 pub mod stdio {
818 use types::common::c95::FILE;
819 use types::os::arch::c95::{c_int, c_char};
820
821 extern {
822 #[link_name = "_popen"]
823 pub fn popen(command: *const c_char,
824 mode: *const c_char) -> *mut FILE;
825 #[link_name = "_pclose"]
826 pub fn pclose(stream: *mut FILE) -> c_int;
827 #[link_name = "_fdopen"]
828 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
829 #[link_name = "_fileno"]
830 pub fn fileno(stream: *mut FILE) -> c_int;
831 }
832 }
833
834 pub mod fcntl {
835 use types::os::arch::c95::{c_int, c_char, wchar_t};
836 extern {
837 #[link_name = "_open"]
838 pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
839 #[link_name = "_wopen"]
840 pub fn wopen(path: *const wchar_t, oflag: c_int, ...) -> c_int;
841 #[link_name = "_creat"]
842 pub fn creat(path: *const c_char, mode: c_int) -> c_int;
843 }
844 }
845
846 pub mod dirent {
847 // Not supplied at all.
848 }
849
850 pub mod unistd {
851 use types::common::c95::c_void;
852 use types::os::arch::c95::{c_int, c_uint, c_char, c_long};
853 use types::os::arch::c99::intptr_t;
854
855 extern {
856 #[link_name = "_access"]
857 pub fn access(path: *const c_char, amode: c_int) -> c_int;
858 #[link_name = "_chdir"]
859 pub fn chdir(dir: *const c_char) -> c_int;
860 #[link_name = "_close"]
861 pub fn close(fd: c_int) -> c_int;
862 #[link_name = "_dup"]
863 pub fn dup(fd: c_int) -> c_int;
864 #[link_name = "_dup2"]
865 pub fn dup2(src: c_int, dst: c_int) -> c_int;
866 #[link_name = "_execv"]
867 pub fn execv(prog: *const c_char,
868 argv: *const *const c_char) -> intptr_t;
869 #[link_name = "_execve"]
870 pub fn execve(prog: *const c_char, argv: *const *const c_char,
871 envp: *const *const c_char)
872 -> c_int;
873 #[link_name = "_execvp"]
874 pub fn execvp(c: *const c_char,
875 argv: *const *const c_char) -> c_int;
876 #[link_name = "_execvpe"]
877 pub fn execvpe(c: *const c_char, argv: *const *const c_char,
878 envp: *const *const c_char) -> c_int;
879 #[link_name = "_getcwd"]
880 pub fn getcwd(buf: *mut c_char, size: c_int) -> *mut c_char;
881 #[link_name = "_getpid"]
882 pub fn getpid() -> c_int;
883 #[link_name = "_isatty"]
884 pub fn isatty(fd: c_int) -> c_int;
885 #[link_name = "_lseek"]
886 pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
887 -> c_long;
888 #[link_name = "_pipe"]
889 pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
890 -> c_int;
891 #[link_name = "_read"]
892 pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
893 -> c_int;
894 #[link_name = "_rmdir"]
895 pub fn rmdir(path: *const c_char) -> c_int;
896 #[link_name = "_unlink"]
897 pub fn unlink(c: *const c_char) -> c_int;
898 #[link_name = "_write"]
899 pub fn write(fd: c_int, buf: *const c_void,
900 count: c_uint) -> c_int;
901 }
902 }
903
904 pub mod mman {
905 }
906 }
907
908
909 #[cfg(target_os = "windows")]
910 pub mod extra {
911
912 pub mod kernel32 {
913 use types::os::arch::c95::{c_uint};
914 use types::os::arch::extra::*;
915
916 extern "system" {
917 pub fn GetEnvironmentVariableW(n: LPCWSTR,
918 v: LPWSTR,
919 nsize: DWORD)
920 -> DWORD;
921 pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
922 -> BOOL;
923 pub fn GetEnvironmentStringsW() -> LPWCH;
924 pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL;
925 pub fn GetModuleFileNameW(hModule: HMODULE,
926 lpFilename: LPWSTR,
927 nSize: DWORD)
928 -> DWORD;
929 pub fn CreateDirectoryW(lpPathName: LPCWSTR,
930 lpSecurityAttributes:
931 LPSECURITY_ATTRIBUTES)
932 -> BOOL;
933 pub fn CopyFileW(lpExistingFileName: LPCWSTR,
934 lpNewFileName: LPCWSTR,
935 bFailIfExists: BOOL)
936 -> BOOL;
937 pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
938 pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
939 pub fn GetCurrentDirectoryW(nBufferLength: DWORD,
940 lpBuffer: LPWSTR)
941 -> DWORD;
942 pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
943 pub fn GetLastError() -> DWORD;
944 pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW)
945 -> HANDLE;
946 pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW)
947 -> BOOL;
948 pub fn FindClose(findFile: HANDLE) -> BOOL;
949 pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
950 hSourceHandle: HANDLE,
951 hTargetProcessHandle: HANDLE,
952 lpTargetHandle: LPHANDLE,
953 dwDesiredAccess: DWORD,
954 bInheritHandle: BOOL,
955 dwOptions: DWORD)
956 -> BOOL;
957 pub fn CloseHandle(hObject: HANDLE) -> BOOL;
958 pub fn OpenProcess(dwDesiredAccess: DWORD,
959 bInheritHandle: BOOL,
960 dwProcessId: DWORD)
961 -> HANDLE;
962 pub fn GetCurrentProcess() -> HANDLE;
963 pub fn CreateProcessW(lpApplicationName: LPCWSTR,
964 lpCommandLine: LPWSTR,
965 lpProcessAttributes:
966 LPSECURITY_ATTRIBUTES,
967 lpThreadAttributes:
968 LPSECURITY_ATTRIBUTES,
969 bInheritHandles: BOOL,
970 dwCreationFlags: DWORD,
971 lpEnvironment: LPVOID,
972 lpCurrentDirectory: LPCWSTR,
973 lpStartupInfo: LPSTARTUPINFOW,
974 lpProcessInformation:
975 LPPROCESS_INFORMATION)
976 -> BOOL;
977 pub fn WaitForSingleObject(hHandle: HANDLE,
978 dwMilliseconds: DWORD)
979 -> DWORD;
980 pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
981 -> BOOL;
982 pub fn GetExitCodeProcess(hProcess: HANDLE,
983 lpExitCode: LPDWORD)
984 -> BOOL;
985 pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
986 pub fn VirtualAlloc(lpAddress: LPVOID,
987 dwSize: SIZE_T,
988 flAllocationType: DWORD,
989 flProtect: DWORD)
990 -> LPVOID;
991 pub fn VirtualFree(lpAddress: LPVOID,
992 dwSize: SIZE_T,
993 dwFreeType: DWORD)
994 -> BOOL;
995 pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
996 pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
997 -> BOOL;
998 pub fn VirtualProtect(lpAddress: LPVOID,
999 dwSize: SIZE_T,
1000 flNewProtect: DWORD,
1001 lpflOldProtect: LPDWORD)
1002 -> BOOL;
1003 pub fn VirtualQuery(lpAddress: LPCVOID,
1004 lpBuffer: PMEMORY_BASIC_INFORMATION,
1005 dwLength: SIZE_T)
1006 -> SIZE_T;
1007 pub fn CreateFileMappingW(hFile: HANDLE,
1008 lpAttributes: LPSECURITY_ATTRIBUTES,
1009 flProtect: DWORD,
1010 dwMaximumSizeHigh: DWORD,
1011 dwMaximumSizeLow: DWORD,
1012 lpName: LPCWSTR)
1013 -> HANDLE;
1014 pub fn MapViewOfFile(hFileMappingObject: HANDLE,
1015 dwDesiredAccess: DWORD,
1016 dwFileOffsetHigh: DWORD,
1017 dwFileOffsetLow: DWORD,
1018 dwNumberOfBytesToMap: SIZE_T)
1019 -> LPVOID;
1020 pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
1021 pub fn MoveFileExW(lpExistingFileName: LPCWSTR,
1022 lpNewFileName: LPCWSTR,
1023 dwFlags: DWORD) -> BOOL;
1024 pub fn CreateHardLinkW(lpSymlinkFileName: LPCWSTR,
1025 lpTargetFileName: LPCWSTR,
1026 lpSecurityAttributes: LPSECURITY_ATTRIBUTES)
1027 -> BOOL;
1028 pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL;
1029 pub fn CreateFileW(lpFileName: LPCWSTR,
1030 dwDesiredAccess: DWORD,
1031 dwShareMode: DWORD,
1032 lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
1033 dwCreationDisposition: DWORD,
1034 dwFlagsAndAttributes: DWORD,
1035 hTemplateFile: HANDLE) -> HANDLE;
1036 pub fn ReadFile(hFile: HANDLE,
1037 lpBuffer: LPVOID,
1038 nNumberOfBytesToRead: DWORD,
1039 lpNumberOfBytesRead: LPDWORD,
1040 lpOverlapped: LPOVERLAPPED) -> BOOL;
1041 pub fn WriteFile(hFile: HANDLE,
1042 lpBuffer: LPCVOID,
1043 nNumberOfBytesToWrite: DWORD,
1044 lpNumberOfBytesWritten: LPDWORD,
1045 lpOverlapped: LPOVERLAPPED) -> BOOL;
1046 pub fn SetFilePointerEx(hFile: HANDLE,
1047 liDistanceToMove: LARGE_INTEGER,
1048 lpNewFilePointer: PLARGE_INTEGER,
1049 dwMoveMethod: DWORD) -> BOOL;
1050 pub fn SetEndOfFile(hFile: HANDLE) -> BOOL;
1051
1052 pub fn GetSystemTimeAsFileTime(
1053 lpSystemTimeAsFileTime: LPFILETIME);
1054
1055 pub fn QueryPerformanceFrequency(
1056 lpFrequency: *mut LARGE_INTEGER) -> BOOL;
1057 pub fn QueryPerformanceCounter(
1058 lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL;
1059
1060 pub fn GetCurrentProcessId() -> DWORD;
1061 pub fn CreateNamedPipeW(
1062 lpName: LPCWSTR,
1063 dwOpenMode: DWORD,
1064 dwPipeMode: DWORD,
1065 nMaxInstances: DWORD,
1066 nOutBufferSize: DWORD,
1067 nInBufferSize: DWORD,
1068 nDefaultTimeOut: DWORD,
1069 lpSecurityAttributes: LPSECURITY_ATTRIBUTES
1070 ) -> HANDLE;
1071 pub fn ConnectNamedPipe(hNamedPipe: HANDLE,
1072 lpOverlapped: LPOVERLAPPED) -> BOOL;
1073 pub fn WaitNamedPipeW(lpNamedPipeName: LPCWSTR,
1074 nTimeOut: DWORD) -> BOOL;
1075 pub fn SetNamedPipeHandleState(hNamedPipe: HANDLE,
1076 lpMode: LPDWORD,
1077 lpMaxCollectionCount: LPDWORD,
1078 lpCollectDataTimeout: LPDWORD)
1079 -> BOOL;
1080 pub fn CreateEventW(lpEventAttributes: LPSECURITY_ATTRIBUTES,
1081 bManualReset: BOOL,
1082 bInitialState: BOOL,
1083 lpName: LPCWSTR) -> HANDLE;
1084 pub fn GetOverlappedResult(hFile: HANDLE,
1085 lpOverlapped: LPOVERLAPPED,
1086 lpNumberOfBytesTransferred: LPDWORD,
1087 bWait: BOOL) -> BOOL;
1088 pub fn DisconnectNamedPipe(hNamedPipe: HANDLE) -> BOOL;
1089 }
1090 }
1091
1092 pub mod msvcrt {
1093 use types::os::arch::c95::c_int;
1094 use types::os::arch::c99::intptr_t;
1095
1096 extern {
1097 #[link_name = "_commit"]
1098 pub fn commit(fd: c_int) -> c_int;
1099
1100 #[link_name = "_get_osfhandle"]
1101 pub fn get_osfhandle(fd: c_int) -> intptr_t;
1102
1103 #[link_name = "_open_osfhandle"]
1104 pub fn open_osfhandle(osfhandle: intptr_t,
1105 flags: c_int) -> c_int;
1106 }
1107 }
1108
1109 pub mod winsock {
1110 use types::os::arch::c95::{c_int, c_long, c_ulong};
1111 use types::os::common::bsd44::SOCKET;
1112
1113 extern "system" {
1114 pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int;
1115 }
1116 }
1117 }
1118
1119 #[cfg(windows)]
1120 pub mod bsd43 {
1121 use types::os::common::bsd44::{sockaddr, SOCKET};
1122 use types::os::arch::c95::{c_int, c_char};
1123
1124 extern "system" {
1125 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> SOCKET;
1126 pub fn connect(socket: SOCKET, address: *const sockaddr,
1127 len: c_int) -> c_int;
1128 pub fn bind(socket: SOCKET, address: *const sockaddr,
1129 address_len: c_int) -> c_int;
1130 pub fn listen(socket: SOCKET, backlog: c_int) -> c_int;
1131 pub fn accept(socket: SOCKET, address: *mut sockaddr,
1132 address_len: *mut c_int) -> SOCKET;
1133 pub fn getpeername(socket: SOCKET, address: *mut sockaddr,
1134 address_len: *mut c_int) -> c_int;
1135 pub fn getsockname(socket: SOCKET, address: *mut sockaddr,
1136 address_len: *mut c_int) -> c_int;
1137 pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
1138 value: *const c_char,
1139 option_len: c_int) -> c_int;
1140 pub fn closesocket(socket: SOCKET) -> c_int;
1141 pub fn recv(socket: SOCKET, buf: *mut c_char, len: c_int,
1142 flags: c_int) -> c_int;
1143 pub fn send(socket: SOCKET, buf: *const c_char, len: c_int,
1144 flags: c_int) -> c_int;
1145 pub fn recvfrom(socket: SOCKET, buf: *mut c_char, len: c_int,
1146 flags: c_int, addr: *mut sockaddr,
1147 addrlen: *mut c_int) -> c_int;
1148 pub fn sendto(socket: SOCKET, buf: *const c_char, len: c_int,
1149 flags: c_int, addr: *const sockaddr,
1150 addrlen: c_int) -> c_int;
1151 pub fn shutdown(socket: SOCKET, how: c_int) -> c_int;
1152 }
1153 }