]> git.proxmox.com Git - rustc.git/blame - vendor/libc/src/windows/mod.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / vendor / libc / src / windows / mod.rs
CommitLineData
476ff2be
SL
1//! Windows CRT definitions
2
69743fb6
XL
3pub type c_schar = i8;
4pub type c_uchar = u8;
5pub type c_short = i16;
6pub type c_ushort = u16;
7pub type c_int = i32;
8pub type c_uint = u32;
9pub type c_float = f32;
10pub type c_double = f64;
11pub type c_longlong = i64;
12pub type c_ulonglong = u64;
13pub type intmax_t = i64;
14pub type uintmax_t = u64;
15
16pub type size_t = usize;
17pub type ptrdiff_t = isize;
18pub type intptr_t = isize;
19pub type uintptr_t = usize;
20pub type ssize_t = isize;
0731742a 21pub type sighandler_t = usize;
69743fb6 22
476ff2be
SL
23pub type c_char = i8;
24pub type c_long = i32;
25pub type c_ulong = u32;
26pub type wchar_t = u16;
27
28pub type clock_t = i32;
29
30cfg_if! {
31 if #[cfg(all(target_arch = "x86", target_env = "gnu"))] {
32 pub type time_t = i32;
33 } else {
34 pub type time_t = i64;
35 }
36}
37
38pub type off_t = i32;
39pub type dev_t = u32;
40pub type ino_t = u16;
532ac7d7 41#[cfg_attr(feature = "extra_traits", derive(Debug))]
476ff2be 42pub enum timezone {}
532ac7d7
XL
43impl ::Copy for timezone {}
44impl ::Clone for timezone {
e74abb32
XL
45 fn clone(&self) -> timezone {
46 *self
47 }
532ac7d7 48}
476ff2be
SL
49pub type time64_t = i64;
50
0731742a
XL
51pub type SOCKET = ::uintptr_t;
52
476ff2be
SL
53s! {
54 // note this is the struct called stat64 in Windows. Not stat, nor stati64.
55 pub struct stat {
56 pub st_dev: dev_t,
57 pub st_ino: ino_t,
58 pub st_mode: u16,
59 pub st_nlink: ::c_short,
60 pub st_uid: ::c_short,
61 pub st_gid: ::c_short,
62 pub st_rdev: dev_t,
63 pub st_size: i64,
64 pub st_atime: time64_t,
65 pub st_mtime: time64_t,
66 pub st_ctime: time64_t,
67 }
68
69 // note that this is called utimbuf64 in Windows
70 pub struct utimbuf {
71 pub actime: time64_t,
72 pub modtime: time64_t,
73 }
74
041b39d2 75 pub struct tm {
0731742a
XL
76 pub tm_sec: ::c_int,
77 pub tm_min: ::c_int,
78 pub tm_hour: ::c_int,
79 pub tm_mday: ::c_int,
80 pub tm_mon: ::c_int,
81 pub tm_year: ::c_int,
82 pub tm_wday: ::c_int,
83 pub tm_yday: ::c_int,
84 pub tm_isdst: ::c_int,
041b39d2
XL
85 }
86
476ff2be
SL
87 pub struct timeval {
88 pub tv_sec: c_long,
89 pub tv_usec: c_long,
90 }
91
92 pub struct timespec {
93 pub tv_sec: time_t,
94 pub tv_nsec: c_long,
95 }
0731742a
XL
96
97 pub struct sockaddr {
98 pub sa_family: c_ushort,
99 pub sa_data: [c_char; 14],
100 }
476ff2be
SL
101}
102
69743fb6
XL
103pub const INT_MIN: c_int = -2147483648;
104pub const INT_MAX: c_int = 2147483647;
105
476ff2be
SL
106pub const EXIT_FAILURE: ::c_int = 1;
107pub const EXIT_SUCCESS: ::c_int = 0;
108pub const RAND_MAX: ::c_int = 32767;
109pub const EOF: ::c_int = -1;
110pub const SEEK_SET: ::c_int = 0;
111pub const SEEK_CUR: ::c_int = 1;
112pub const SEEK_END: ::c_int = 2;
113pub const _IOFBF: ::c_int = 0;
114pub const _IONBF: ::c_int = 4;
115pub const _IOLBF: ::c_int = 64;
116pub const BUFSIZ: ::c_uint = 512;
117pub const FOPEN_MAX: ::c_uint = 20;
118pub const FILENAME_MAX: ::c_uint = 260;
119
476ff2be
SL
120pub const O_RDONLY: ::c_int = 0;
121pub const O_WRONLY: ::c_int = 1;
122pub const O_RDWR: ::c_int = 2;
123pub const O_APPEND: ::c_int = 8;
124pub const O_CREAT: ::c_int = 256;
125pub const O_EXCL: ::c_int = 1024;
126pub const O_TEXT: ::c_int = 16384;
127pub const O_BINARY: ::c_int = 32768;
128pub const O_NOINHERIT: ::c_int = 128;
129pub const O_TRUNC: ::c_int = 512;
130pub const S_IFCHR: ::c_int = 8192;
131pub const S_IFDIR: ::c_int = 16384;
132pub const S_IFREG: ::c_int = 32768;
133pub const S_IFMT: ::c_int = 61440;
134pub const S_IEXEC: ::c_int = 64;
135pub const S_IWRITE: ::c_int = 128;
136pub const S_IREAD: ::c_int = 256;
137
138pub const LC_ALL: ::c_int = 0;
139pub const LC_COLLATE: ::c_int = 1;
140pub const LC_CTYPE: ::c_int = 2;
141pub const LC_MONETARY: ::c_int = 3;
142pub const LC_NUMERIC: ::c_int = 4;
143pub const LC_TIME: ::c_int = 5;
144
145pub const EPERM: ::c_int = 1;
146pub const ENOENT: ::c_int = 2;
147pub const ESRCH: ::c_int = 3;
148pub const EINTR: ::c_int = 4;
149pub const EIO: ::c_int = 5;
150pub const ENXIO: ::c_int = 6;
151pub const E2BIG: ::c_int = 7;
152pub const ENOEXEC: ::c_int = 8;
153pub const EBADF: ::c_int = 9;
154pub const ECHILD: ::c_int = 10;
155pub const EAGAIN: ::c_int = 11;
156pub const ENOMEM: ::c_int = 12;
157pub const EACCES: ::c_int = 13;
158pub const EFAULT: ::c_int = 14;
159pub const EBUSY: ::c_int = 16;
160pub const EEXIST: ::c_int = 17;
161pub const EXDEV: ::c_int = 18;
162pub const ENODEV: ::c_int = 19;
163pub const ENOTDIR: ::c_int = 20;
164pub const EISDIR: ::c_int = 21;
165pub const EINVAL: ::c_int = 22;
166pub const ENFILE: ::c_int = 23;
167pub const EMFILE: ::c_int = 24;
168pub const ENOTTY: ::c_int = 25;
169pub const EFBIG: ::c_int = 27;
170pub const ENOSPC: ::c_int = 28;
171pub const ESPIPE: ::c_int = 29;
172pub const EROFS: ::c_int = 30;
173pub const EMLINK: ::c_int = 31;
174pub const EPIPE: ::c_int = 32;
175pub const EDOM: ::c_int = 33;
176pub const ERANGE: ::c_int = 34;
177pub const EDEADLK: ::c_int = 36;
178pub const EDEADLOCK: ::c_int = 36;
179pub const ENAMETOOLONG: ::c_int = 38;
180pub const ENOLCK: ::c_int = 39;
181pub const ENOSYS: ::c_int = 40;
182pub const ENOTEMPTY: ::c_int = 41;
183pub const EILSEQ: ::c_int = 42;
184pub const STRUNCATE: ::c_int = 80;
185
dfeec247
XL
186// POSIX Supplement (from errno.h)
187pub const EADDRINUSE: ::c_int = 100;
188pub const EADDRNOTAVAIL: ::c_int = 101;
189pub const EAFNOSUPPORT: ::c_int = 102;
190pub const EALREADY: ::c_int = 103;
191pub const EBADMSG: ::c_int = 104;
192pub const ECANCELED: ::c_int = 105;
193pub const ECONNABORTED: ::c_int = 106;
194pub const ECONNREFUSED: ::c_int = 107;
195pub const ECONNRESET: ::c_int = 108;
196pub const EDESTADDRREQ: ::c_int = 109;
197pub const EHOSTUNREACH: ::c_int = 110;
198pub const EIDRM: ::c_int = 111;
199pub const EINPROGRESS: ::c_int = 112;
200pub const EISCONN: ::c_int = 113;
201pub const ELOOP: ::c_int = 114;
202pub const EMSGSIZE: ::c_int = 115;
203pub const ENETDOWN: ::c_int = 116;
204pub const ENETRESET: ::c_int = 117;
205pub const ENETUNREACH: ::c_int = 118;
206pub const ENOBUFS: ::c_int = 119;
207pub const ENODATA: ::c_int = 120;
208pub const ENOLINK: ::c_int = 121;
209pub const ENOMSG: ::c_int = 122;
210pub const ENOPROTOOPT: ::c_int = 123;
211pub const ENOSR: ::c_int = 124;
212pub const ENOSTR: ::c_int = 125;
213pub const ENOTCONN: ::c_int = 126;
214pub const ENOTRECOVERABLE: ::c_int = 127;
215pub const ENOTSOCK: ::c_int = 128;
216pub const ENOTSUP: ::c_int = 129;
217pub const EOPNOTSUPP: ::c_int = 130;
218pub const EOVERFLOW: ::c_int = 132;
219pub const EOWNERDEAD: ::c_int = 133;
220pub const EPROTO: ::c_int = 134;
221pub const EPROTONOSUPPORT: ::c_int = 135;
222pub const EPROTOTYPE: ::c_int = 136;
223pub const ETIME: ::c_int = 137;
224pub const ETIMEDOUT: ::c_int = 138;
225pub const ETXTBSY: ::c_int = 139;
226pub const EWOULDBLOCK: ::c_int = 140;
227
0731742a
XL
228// signal codes
229pub const SIGINT: ::c_int = 2;
230pub const SIGILL: ::c_int = 4;
231pub const SIGFPE: ::c_int = 8;
232pub const SIGSEGV: ::c_int = 11;
233pub const SIGTERM: ::c_int = 15;
234pub const SIGABRT: ::c_int = 22;
235pub const NSIG: ::c_int = 23;
236pub const SIG_ERR: ::c_int = -1;
237
ea8adc8c 238// inline comment below appeases style checker
69743fb6 239#[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if "
8bb4bdeb
XL
240#[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))]
241#[link(name = "libcmt", cfg(target_feature = "crt-static"))]
e74abb32 242extern "C" {}
476ff2be 243
532ac7d7 244#[cfg_attr(feature = "extra_traits", derive(Debug))]
69743fb6 245pub enum FILE {}
532ac7d7
XL
246impl ::Copy for FILE {}
247impl ::Clone for FILE {
e74abb32
XL
248 fn clone(&self) -> FILE {
249 *self
250 }
532ac7d7
XL
251}
252#[cfg_attr(feature = "extra_traits", derive(Debug))]
ba9703b0 253pub enum fpos_t {} // FIXME: fill this out with a struct
532ac7d7
XL
254impl ::Copy for fpos_t {}
255impl ::Clone for fpos_t {
e74abb32
XL
256 fn clone(&self) -> fpos_t {
257 *self
258 }
532ac7d7 259}
69743fb6 260
e74abb32 261extern "C" {
69743fb6
XL
262 pub fn isalnum(c: c_int) -> c_int;
263 pub fn isalpha(c: c_int) -> c_int;
264 pub fn iscntrl(c: c_int) -> c_int;
265 pub fn isdigit(c: c_int) -> c_int;
266 pub fn isgraph(c: c_int) -> c_int;
267 pub fn islower(c: c_int) -> c_int;
268 pub fn isprint(c: c_int) -> c_int;
269 pub fn ispunct(c: c_int) -> c_int;
270 pub fn isspace(c: c_int) -> c_int;
271 pub fn isupper(c: c_int) -> c_int;
272 pub fn isxdigit(c: c_int) -> c_int;
e74abb32 273 pub fn isblank(c: c_int) -> c_int;
69743fb6
XL
274 pub fn tolower(c: c_int) -> c_int;
275 pub fn toupper(c: c_int) -> c_int;
276 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
e74abb32
XL
277 pub fn freopen(
278 filename: *const c_char,
279 mode: *const c_char,
280 file: *mut FILE,
281 ) -> *mut FILE;
69743fb6
XL
282 pub fn fflush(file: *mut FILE) -> c_int;
283 pub fn fclose(file: *mut FILE) -> c_int;
284 pub fn remove(filename: *const c_char) -> c_int;
285 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
286 pub fn tmpfile() -> *mut FILE;
e74abb32
XL
287 pub fn setvbuf(
288 stream: *mut FILE,
289 buffer: *mut c_char,
290 mode: c_int,
291 size: size_t,
292 ) -> c_int;
69743fb6
XL
293 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
294 pub fn getchar() -> c_int;
295 pub fn putchar(c: c_int) -> c_int;
296 pub fn fgetc(stream: *mut FILE) -> c_int;
e74abb32
XL
297 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
298 -> *mut c_char;
69743fb6
XL
299 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
300 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
301 pub fn puts(s: *const c_char) -> c_int;
302 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
e74abb32
XL
303 pub fn fread(
304 ptr: *mut c_void,
305 size: size_t,
306 nobj: size_t,
307 stream: *mut FILE,
308 ) -> size_t;
309 pub fn fwrite(
310 ptr: *const c_void,
311 size: size_t,
312 nobj: size_t,
313 stream: *mut FILE,
314 ) -> size_t;
69743fb6
XL
315 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
316 pub fn ftell(stream: *mut FILE) -> c_long;
317 pub fn rewind(stream: *mut FILE);
318 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
319 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
320 pub fn feof(stream: *mut FILE) -> c_int;
321 pub fn ferror(stream: *mut FILE) -> c_int;
322 pub fn perror(s: *const c_char);
323 pub fn atoi(s: *const c_char) -> c_int;
324 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
e74abb32
XL
325 pub fn strtol(
326 s: *const c_char,
327 endp: *mut *mut c_char,
328 base: c_int,
329 ) -> c_long;
330 pub fn strtoul(
331 s: *const c_char,
332 endp: *mut *mut c_char,
333 base: c_int,
334 ) -> c_ulong;
69743fb6
XL
335 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
336 pub fn malloc(size: size_t) -> *mut c_void;
337 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
338 pub fn free(p: *mut c_void);
339 pub fn abort() -> !;
340 pub fn exit(status: c_int) -> !;
341 pub fn _exit(status: c_int) -> !;
e74abb32 342 pub fn atexit(cb: extern "C" fn()) -> c_int;
69743fb6
XL
343 pub fn system(s: *const c_char) -> c_int;
344 pub fn getenv(s: *const c_char) -> *mut c_char;
345
346 pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
e74abb32
XL
347 pub fn strncpy(
348 dst: *mut c_char,
349 src: *const c_char,
350 n: size_t,
351 ) -> *mut c_char;
69743fb6 352 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
e74abb32
XL
353 pub fn strncat(
354 s: *mut c_char,
355 ct: *const c_char,
356 n: size_t,
357 ) -> *mut c_char;
69743fb6
XL
358 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
359 pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
360 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
361 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
362 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
363 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
364 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
365 pub fn strdup(cs: *const c_char) -> *mut c_char;
366 pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
367 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
368 pub fn strlen(cs: *const c_char) -> size_t;
369 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
370 pub fn strerror(n: c_int) -> *mut c_char;
371 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
372 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
373 pub fn wcslen(buf: *const wchar_t) -> size_t;
e74abb32
XL
374 pub fn wcstombs(
375 dest: *mut c_char,
376 src: *const wchar_t,
377 n: size_t,
378 ) -> ::size_t;
69743fb6
XL
379
380 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
381 pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
e74abb32
XL
382 pub fn memcpy(
383 dest: *mut c_void,
384 src: *const c_void,
385 n: size_t,
386 ) -> *mut c_void;
387 pub fn memmove(
388 dest: *mut c_void,
389 src: *const c_void,
390 n: size_t,
391 ) -> *mut c_void;
69743fb6
XL
392 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
393
394 pub fn abs(i: c_int) -> c_int;
395 pub fn atof(s: *const c_char) -> c_double;
396 pub fn labs(i: c_long) -> c_long;
397 pub fn rand() -> c_int;
398 pub fn srand(seed: c_uint);
399
0731742a
XL
400 pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t;
401 pub fn raise(signum: c_int) -> c_int;
402
ba9703b0
XL
403 #[link_name = "_gmtime64_s"]
404 pub fn gmtime_s(destTime: *mut tm, srcTime: *const time_t) -> ::c_int;
dfeec247
XL
405 #[link_name = "_time64"]
406 pub fn time(destTime: *mut time_t) -> time_t;
476ff2be
SL
407 #[link_name = "_chmod"]
408 pub fn chmod(path: *const c_char, mode: ::c_int) -> ::c_int;
409 #[link_name = "_wchmod"]
410 pub fn wchmod(path: *const wchar_t, mode: ::c_int) -> ::c_int;
411 #[link_name = "_mkdir"]
412 pub fn mkdir(path: *const c_char) -> ::c_int;
413 #[link_name = "_wrmdir"]
414 pub fn wrmdir(path: *const wchar_t) -> ::c_int;
415 #[link_name = "_fstat64"]
416 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
417 #[link_name = "_stat64"]
418 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
419 #[link_name = "_wstat64"]
420 pub fn wstat(path: *const wchar_t, buf: *mut stat) -> ::c_int;
421 #[link_name = "_wutime64"]
422 pub fn wutime(file: *const wchar_t, buf: *mut utimbuf) -> ::c_int;
423 #[link_name = "_popen"]
424 pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
425 #[link_name = "_pclose"]
426 pub fn pclose(stream: *mut ::FILE) -> ::c_int;
427 #[link_name = "_fdopen"]
428 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
429 #[link_name = "_fileno"]
430 pub fn fileno(stream: *mut ::FILE) -> ::c_int;
431 #[link_name = "_open"]
432 pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
433 #[link_name = "_wopen"]
434 pub fn wopen(path: *const wchar_t, oflag: ::c_int, ...) -> ::c_int;
435 #[link_name = "_creat"]
436 pub fn creat(path: *const c_char, mode: ::c_int) -> ::c_int;
437 #[link_name = "_access"]
438 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
439 #[link_name = "_chdir"]
440 pub fn chdir(dir: *const c_char) -> ::c_int;
441 #[link_name = "_close"]
442 pub fn close(fd: ::c_int) -> ::c_int;
443 #[link_name = "_dup"]
444 pub fn dup(fd: ::c_int) -> ::c_int;
445 #[link_name = "_dup2"]
446 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
447 #[link_name = "_execv"]
e74abb32
XL
448 pub fn execv(
449 prog: *const c_char,
450 argv: *const *const c_char,
451 ) -> ::intptr_t;
476ff2be 452 #[link_name = "_execve"]
e74abb32
XL
453 pub fn execve(
454 prog: *const c_char,
455 argv: *const *const c_char,
456 envp: *const *const c_char,
457 ) -> ::c_int;
476ff2be
SL
458 #[link_name = "_execvp"]
459 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
460 #[link_name = "_execvpe"]
e74abb32
XL
461 pub fn execvpe(
462 c: *const c_char,
463 argv: *const *const c_char,
464 envp: *const *const c_char,
465 ) -> ::c_int;
476ff2be
SL
466 #[link_name = "_getcwd"]
467 pub fn getcwd(buf: *mut c_char, size: ::c_int) -> *mut c_char;
468 #[link_name = "_getpid"]
469 pub fn getpid() -> ::c_int;
470 #[link_name = "_isatty"]
471 pub fn isatty(fd: ::c_int) -> ::c_int;
472 #[link_name = "_lseek"]
473 pub fn lseek(fd: ::c_int, offset: c_long, origin: ::c_int) -> c_long;
dfeec247
XL
474 #[link_name = "_lseeki64"]
475 pub fn lseek64(
476 fd: ::c_int,
477 offset: c_longlong,
478 origin: ::c_int,
479 ) -> c_longlong;
476ff2be 480 #[link_name = "_pipe"]
e74abb32
XL
481 pub fn pipe(
482 fds: *mut ::c_int,
483 psize: ::c_uint,
484 textmode: ::c_int,
485 ) -> ::c_int;
476ff2be
SL
486 #[link_name = "_read"]
487 pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::c_uint) -> ::c_int;
488 #[link_name = "_rmdir"]
489 pub fn rmdir(path: *const c_char) -> ::c_int;
490 #[link_name = "_unlink"]
491 pub fn unlink(c: *const c_char) -> ::c_int;
492 #[link_name = "_write"]
e74abb32
XL
493 pub fn write(
494 fd: ::c_int,
495 buf: *const ::c_void,
496 count: ::c_uint,
497 ) -> ::c_int;
476ff2be
SL
498 #[link_name = "_commit"]
499 pub fn commit(fd: ::c_int) -> ::c_int;
500 #[link_name = "_get_osfhandle"]
501 pub fn get_osfhandle(fd: ::c_int) -> ::intptr_t;
502 #[link_name = "_open_osfhandle"]
503 pub fn open_osfhandle(osfhandle: ::intptr_t, flags: ::c_int) -> ::c_int;
504 pub fn setlocale(category: ::c_int, locale: *const c_char) -> *mut c_char;
505 #[link_name = "_wsetlocale"]
e74abb32
XL
506 pub fn wsetlocale(
507 category: ::c_int,
508 locale: *const wchar_t,
509 ) -> *mut wchar_t;
476ff2be 510}
69743fb6 511
0731742a
XL
512extern "system" {
513 pub fn listen(s: SOCKET, backlog: ::c_int) -> ::c_int;
e74abb32
XL
514 pub fn accept(
515 s: SOCKET,
516 addr: *mut ::sockaddr,
517 addrlen: *mut ::c_int,
518 ) -> SOCKET;
519 pub fn bind(
520 s: SOCKET,
521 name: *const ::sockaddr,
522 namelen: ::c_int,
523 ) -> ::c_int;
524 pub fn connect(
525 s: SOCKET,
526 name: *const ::sockaddr,
527 namelen: ::c_int,
528 ) -> ::c_int;
529 pub fn getpeername(
530 s: SOCKET,
531 name: *mut ::sockaddr,
532 nameln: *mut ::c_int,
533 ) -> ::c_int;
534 pub fn getsockname(
535 s: SOCKET,
536 name: *mut ::sockaddr,
537 nameln: *mut ::c_int,
538 ) -> ::c_int;
539 pub fn getsockopt(
540 s: SOCKET,
541 level: ::c_int,
542 optname: ::c_int,
543 optval: *mut ::c_char,
544 optlen: *mut ::c_int,
545 ) -> ::c_int;
546 pub fn recvfrom(
547 s: SOCKET,
548 buf: *mut ::c_char,
549 len: ::c_int,
550 flags: ::c_int,
551 from: *mut ::sockaddr,
552 fromlen: *mut ::c_int,
553 ) -> ::c_int;
554 pub fn sendto(
555 s: SOCKET,
556 buf: *const ::c_char,
557 len: ::c_int,
558 flags: ::c_int,
559 to: *const ::sockaddr,
560 tolen: ::c_int,
561 ) -> ::c_int;
562 pub fn setsockopt(
563 s: SOCKET,
564 level: ::c_int,
565 optname: ::c_int,
566 optval: *const ::c_char,
567 optlen: ::c_int,
568 ) -> ::c_int;
569 pub fn socket(
570 af: ::c_int,
571 socket_type: ::c_int,
572 protocol: ::c_int,
573 ) -> SOCKET;
0731742a
XL
574}
575
69743fb6 576cfg_if! {
532ac7d7
XL
577 if #[cfg(libc_core_cvoid)] {
578 pub use ::ffi::c_void;
69743fb6
XL
579 } else {
580 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
581 // enable more optimization opportunities around it recognizing things
582 // like malloc/free.
583 #[repr(u8)]
532ac7d7
XL
584 #[allow(missing_copy_implementations)]
585 #[allow(missing_debug_implementations)]
69743fb6
XL
586 pub enum c_void {
587 // Two dummy variants so the #[repr] attribute can be used.
588 #[doc(hidden)]
589 __variant1,
590 #[doc(hidden)]
591 __variant2,
592 }
593 }
594}
595
596cfg_if! {
597 if #[cfg(all(target_env = "gnu"))] {
598 mod gnu;
599 pub use self::gnu::*;
600 } else if #[cfg(all(target_env = "msvc"))] {
601 mod msvc;
602 pub use self::msvc::*;
603 } else {
604 // Unknown target_env
605 }
532ac7d7 606}