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