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