1use crate::prelude::*;
7
8pub type intmax_t = i64;
9pub type uintmax_t = u64;
10
11pub type size_t = usize;
12pub type ptrdiff_t = isize;
13pub type intptr_t = isize;
14pub type uintptr_t = usize;
15pub type ssize_t = isize;
16
17pub type pid_t = i32;
18pub type in_addr_t = u32;
19pub type in_port_t = u16;
20pub type sighandler_t = size_t;
21pub type cc_t = c_uchar;
22
23cfg_if! {
24 if #[cfg(any(
25 target_os = "espidf",
26 target_os = "horizon",
27 target_os = "vita"
28 ))] {
29 pub type uid_t = c_ushort;
30 pub type gid_t = c_ushort;
31 } else if #[cfg(target_os = "nto")] {
32 pub type uid_t = i32;
33 pub type gid_t = i32;
34 } else {
35 pub type uid_t = u32;
36 pub type gid_t = u32;
37 }
38}
39
40missing! {
41 #[cfg_attr(feature = "extra_traits", derive(Debug))]
42 pub enum DIR {}
43}
44pub type locale_t = *mut c_void;
45
46s! {
47 pub struct group {
48 pub gr_name: *mut c_char,
49 pub gr_passwd: *mut c_char,
50 pub gr_gid: crate::gid_t,
51 pub gr_mem: *mut *mut c_char,
52 }
53
54 pub struct utimbuf {
55 pub actime: time_t,
56 pub modtime: time_t,
57 }
58
59 pub struct timeval {
61 pub tv_sec: time_t,
62 pub tv_usec: suseconds_t,
63 }
64
65 pub struct timespec {
68 pub tv_sec: time_t,
69 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
70 pub tv_nsec: i64,
71 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
72 pub tv_nsec: c_long,
73 }
74
75 pub struct rlimit {
76 pub rlim_cur: rlim_t,
77 pub rlim_max: rlim_t,
78 }
79
80 pub struct rusage {
81 pub ru_utime: timeval,
82 pub ru_stime: timeval,
83 pub ru_maxrss: c_long,
84 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
85 __pad1: u32,
86 pub ru_ixrss: c_long,
87 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
88 __pad2: u32,
89 pub ru_idrss: c_long,
90 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
91 __pad3: u32,
92 pub ru_isrss: c_long,
93 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
94 __pad4: u32,
95 pub ru_minflt: c_long,
96 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
97 __pad5: u32,
98 pub ru_majflt: c_long,
99 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
100 __pad6: u32,
101 pub ru_nswap: c_long,
102 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
103 __pad7: u32,
104 pub ru_inblock: c_long,
105 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
106 __pad8: u32,
107 pub ru_oublock: c_long,
108 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
109 __pad9: u32,
110 pub ru_msgsnd: c_long,
111 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
112 __pad10: u32,
113 pub ru_msgrcv: c_long,
114 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
115 __pad11: u32,
116 pub ru_nsignals: c_long,
117 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
118 __pad12: u32,
119 pub ru_nvcsw: c_long,
120 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
121 __pad13: u32,
122 pub ru_nivcsw: c_long,
123 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
124 __pad14: u32,
125
126 #[cfg(any(target_env = "musl", target_env = "ohos", target_os = "emscripten"))]
127 __reserved: [c_long; 16],
128 }
129
130 pub struct ipv6_mreq {
131 pub ipv6mr_multiaddr: in6_addr,
132 #[cfg(target_os = "android")]
133 pub ipv6mr_interface: c_int,
134 #[cfg(not(target_os = "android"))]
135 pub ipv6mr_interface: c_uint,
136 }
137
138 #[cfg(not(target_os = "cygwin"))]
139 pub struct hostent {
140 pub h_name: *mut c_char,
141 pub h_aliases: *mut *mut c_char,
142 pub h_addrtype: c_int,
143 pub h_length: c_int,
144 pub h_addr_list: *mut *mut c_char,
145 }
146
147 pub struct iovec {
148 pub iov_base: *mut c_void,
149 pub iov_len: size_t,
150 }
151
152 pub struct pollfd {
153 pub fd: c_int,
154 pub events: c_short,
155 pub revents: c_short,
156 }
157
158 pub struct winsize {
159 pub ws_row: c_ushort,
160 pub ws_col: c_ushort,
161 pub ws_xpixel: c_ushort,
162 pub ws_ypixel: c_ushort,
163 }
164
165 #[cfg(not(target_os = "cygwin"))]
166 pub struct linger {
167 pub l_onoff: c_int,
168 pub l_linger: c_int,
169 }
170
171 pub struct sigval {
172 pub sival_ptr: *mut c_void,
174 }
175
176 pub struct itimerval {
178 pub it_interval: crate::timeval,
179 pub it_value: crate::timeval,
180 }
181
182 pub struct tms {
184 pub tms_utime: crate::clock_t,
185 pub tms_stime: crate::clock_t,
186 pub tms_cutime: crate::clock_t,
187 pub tms_cstime: crate::clock_t,
188 }
189
190 pub struct servent {
191 pub s_name: *mut c_char,
192 pub s_aliases: *mut *mut c_char,
193 #[cfg(target_os = "cygwin")]
194 pub s_port: c_short,
195 #[cfg(not(target_os = "cygwin"))]
196 pub s_port: c_int,
197 pub s_proto: *mut c_char,
198 }
199
200 pub struct protoent {
201 pub p_name: *mut c_char,
202 pub p_aliases: *mut *mut c_char,
203 #[cfg(not(target_os = "cygwin"))]
204 pub p_proto: c_int,
205 #[cfg(target_os = "cygwin")]
206 pub p_proto: c_short,
207 }
208
209 #[repr(align(4))]
210 pub struct in6_addr {
211 pub s6_addr: [u8; 16],
212 }
213}
214
215pub const INT_MIN: c_int = -2147483648;
216pub const INT_MAX: c_int = 2147483647;
217
218pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
219pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
220pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
221
222cfg_if! {
223 if #[cfg(not(target_os = "nto"))] {
224 pub const DT_UNKNOWN: u8 = 0;
225 pub const DT_FIFO: u8 = 1;
226 pub const DT_CHR: u8 = 2;
227 pub const DT_DIR: u8 = 4;
228 pub const DT_BLK: u8 = 6;
229 pub const DT_REG: u8 = 8;
230 pub const DT_LNK: u8 = 10;
231 pub const DT_SOCK: u8 = 12;
232 }
233}
234cfg_if! {
235 if #[cfg(not(target_os = "redox"))] {
236 pub const FD_CLOEXEC: c_int = 0x1;
237 }
238}
239
240cfg_if! {
241 if #[cfg(not(target_os = "nto"))] {
242 pub const USRQUOTA: c_int = 0;
243 pub const GRPQUOTA: c_int = 1;
244 }
245}
246pub const SIGIOT: c_int = 6;
247
248pub const S_ISUID: crate::mode_t = 0o4000;
249pub const S_ISGID: crate::mode_t = 0o2000;
250pub const S_ISVTX: crate::mode_t = 0o1000;
251
252cfg_if! {
253 if #[cfg(not(any(
254 target_os = "haiku",
255 target_os = "illumos",
256 target_os = "solaris",
257 target_os = "cygwin"
258 )))] {
259 pub const IF_NAMESIZE: size_t = 16;
260 pub const IFNAMSIZ: size_t = IF_NAMESIZE;
261 }
262}
263
264pub const LOG_EMERG: c_int = 0;
265pub const LOG_ALERT: c_int = 1;
266pub const LOG_CRIT: c_int = 2;
267pub const LOG_ERR: c_int = 3;
268pub const LOG_WARNING: c_int = 4;
269pub const LOG_NOTICE: c_int = 5;
270pub const LOG_INFO: c_int = 6;
271pub const LOG_DEBUG: c_int = 7;
272
273pub const LOG_KERN: c_int = 0;
274pub const LOG_USER: c_int = 1 << 3;
275pub const LOG_MAIL: c_int = 2 << 3;
276pub const LOG_DAEMON: c_int = 3 << 3;
277pub const LOG_AUTH: c_int = 4 << 3;
278pub const LOG_SYSLOG: c_int = 5 << 3;
279pub const LOG_LPR: c_int = 6 << 3;
280pub const LOG_NEWS: c_int = 7 << 3;
281pub const LOG_UUCP: c_int = 8 << 3;
282pub const LOG_LOCAL0: c_int = 16 << 3;
283pub const LOG_LOCAL1: c_int = 17 << 3;
284pub const LOG_LOCAL2: c_int = 18 << 3;
285pub const LOG_LOCAL3: c_int = 19 << 3;
286pub const LOG_LOCAL4: c_int = 20 << 3;
287pub const LOG_LOCAL5: c_int = 21 << 3;
288pub const LOG_LOCAL6: c_int = 22 << 3;
289pub const LOG_LOCAL7: c_int = 23 << 3;
290
291cfg_if! {
292 if #[cfg(not(target_os = "haiku"))] {
293 pub const LOG_PID: c_int = 0x01;
294 pub const LOG_CONS: c_int = 0x02;
295 pub const LOG_ODELAY: c_int = 0x04;
296 pub const LOG_NDELAY: c_int = 0x08;
297 pub const LOG_NOWAIT: c_int = 0x10;
298 }
299}
300pub const LOG_PRIMASK: c_int = 7;
301pub const LOG_FACMASK: c_int = 0x3f8;
302
303cfg_if! {
304 if #[cfg(not(target_os = "nto"))] {
305 pub const PRIO_MIN: c_int = -20;
306 pub const PRIO_MAX: c_int = 20;
307 }
308}
309pub const IPPROTO_ICMP: c_int = 1;
310pub const IPPROTO_ICMPV6: c_int = 58;
311pub const IPPROTO_TCP: c_int = 6;
312pub const IPPROTO_UDP: c_int = 17;
313pub const IPPROTO_IP: c_int = 0;
314pub const IPPROTO_IPV6: c_int = 41;
315
316pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
317pub const INADDR_ANY: in_addr_t = 0;
318pub const INADDR_BROADCAST: in_addr_t = 4294967295;
319pub const INADDR_NONE: in_addr_t = 4294967295;
320
321pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr {
322 s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
323};
324
325pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr {
326 s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
327};
328
329pub const ARPOP_REQUEST: u16 = 1;
330pub const ARPOP_REPLY: u16 = 2;
331
332pub const ATF_COM: c_int = 0x02;
333pub const ATF_PERM: c_int = 0x04;
334pub const ATF_PUBL: c_int = 0x08;
335pub const ATF_USETRAILERS: c_int = 0x10;
336
337pub const FNM_PERIOD: c_int = 1 << 2;
338pub const FNM_NOMATCH: c_int = 1;
339
340cfg_if! {
341 if #[cfg(any(target_os = "illumos", target_os = "solaris",))] {
342 pub const FNM_CASEFOLD: c_int = 1 << 3;
343 } else {
344 pub const FNM_CASEFOLD: c_int = 1 << 4;
345 }
346}
347
348cfg_if! {
349 if #[cfg(any(
350 target_os = "macos",
351 target_os = "freebsd",
352 target_os = "android",
353 target_os = "openbsd",
354 target_os = "cygwin",
355 ))] {
356 pub const FNM_PATHNAME: c_int = 1 << 1;
357 pub const FNM_NOESCAPE: c_int = 1 << 0;
358 } else {
359 pub const FNM_PATHNAME: c_int = 1 << 0;
360 pub const FNM_NOESCAPE: c_int = 1 << 1;
361 }
362}
363
364extern "C" {
365 pub static in6addr_loopback: in6_addr;
366 pub static in6addr_any: in6_addr;
367}
368
369cfg_if! {
370 if #[cfg(any(
371 target_os = "l4re",
372 target_os = "espidf",
373 target_os = "nuttx"
374 ))] {
375 } else if #[cfg(feature = "std")] {
380 } else if #[cfg(all(
383 any(
384 all(
385 target_os = "linux",
386 any(target_env = "gnu", target_env = "uclibc")
387 ),
388 target_os = "cygwin"
389 ),
390 feature = "rustc-dep-of-std"
391 ))] {
392 #[link(
393 name = "util",
394 kind = "static",
395 modifiers = "-bundle",
396 cfg(target_feature = "crt-static")
397 )]
398 #[link(
399 name = "rt",
400 kind = "static",
401 modifiers = "-bundle",
402 cfg(target_feature = "crt-static")
403 )]
404 #[link(
405 name = "pthread",
406 kind = "static",
407 modifiers = "-bundle",
408 cfg(target_feature = "crt-static")
409 )]
410 #[link(
411 name = "m",
412 kind = "static",
413 modifiers = "-bundle",
414 cfg(target_feature = "crt-static")
415 )]
416 #[link(
417 name = "dl",
418 kind = "static",
419 modifiers = "-bundle",
420 cfg(target_feature = "crt-static")
421 )]
422 #[link(
423 name = "c",
424 kind = "static",
425 modifiers = "-bundle",
426 cfg(target_feature = "crt-static")
427 )]
428 #[link(
429 name = "gcc_eh",
430 kind = "static",
431 modifiers = "-bundle",
432 cfg(target_feature = "crt-static")
433 )]
434 #[link(
435 name = "gcc",
436 kind = "static",
437 modifiers = "-bundle",
438 cfg(target_feature = "crt-static")
439 )]
440 #[link(
441 name = "c",
442 kind = "static",
443 modifiers = "-bundle",
444 cfg(target_feature = "crt-static")
445 )]
446 #[link(name = "util", cfg(not(target_feature = "crt-static")))]
447 #[link(name = "rt", cfg(not(target_feature = "crt-static")))]
448 #[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
449 #[link(name = "m", cfg(not(target_feature = "crt-static")))]
450 #[link(name = "dl", cfg(not(target_feature = "crt-static")))]
451 #[link(name = "c", cfg(not(target_feature = "crt-static")))]
452 extern "C" {}
453 } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
454 #[cfg_attr(
455 feature = "rustc-dep-of-std",
456 link(
457 name = "c",
458 kind = "static",
459 modifiers = "-bundle",
460 cfg(target_feature = "crt-static")
461 )
462 )]
463 #[cfg_attr(
464 feature = "rustc-dep-of-std",
465 link(name = "c", cfg(not(target_feature = "crt-static")))
466 )]
467 extern "C" {}
468 } else if #[cfg(target_os = "emscripten")] {
469 } else if #[cfg(all(target_os = "android", feature = "rustc-dep-of-std"))] {
472 #[link(
473 name = "c",
474 kind = "static",
475 modifiers = "-bundle",
476 cfg(target_feature = "crt-static")
477 )]
478 #[link(
479 name = "m",
480 kind = "static",
481 modifiers = "-bundle",
482 cfg(target_feature = "crt-static")
483 )]
484 #[link(name = "m", cfg(not(target_feature = "crt-static")))]
485 #[link(name = "c", cfg(not(target_feature = "crt-static")))]
486 extern "C" {}
487 } else if #[cfg(any(
488 target_os = "macos",
489 target_os = "ios",
490 target_os = "tvos",
491 target_os = "watchos",
492 target_os = "visionos",
493 target_os = "android",
494 target_os = "openbsd",
495 target_os = "nto",
496 ))] {
497 #[link(name = "c")]
498 #[link(name = "m")]
499 extern "C" {}
500 } else if #[cfg(target_os = "haiku")] {
501 #[link(name = "root")]
502 #[link(name = "network")]
503 extern "C" {}
504 } else if #[cfg(target_env = "newlib")] {
505 #[link(name = "c")]
506 #[link(name = "m")]
507 extern "C" {}
508 } else if #[cfg(target_env = "illumos")] {
509 #[link(name = "c")]
510 #[link(name = "m")]
511 extern "C" {}
512 } else if #[cfg(target_os = "redox")] {
513 #[cfg_attr(
514 feature = "rustc-dep-of-std",
515 link(
516 name = "c",
517 kind = "static",
518 modifiers = "-bundle",
519 cfg(target_feature = "crt-static")
520 )
521 )]
522 #[cfg_attr(
523 feature = "rustc-dep-of-std",
524 link(name = "c", cfg(not(target_feature = "crt-static")))
525 )]
526 extern "C" {}
527 } else if #[cfg(target_os = "aix")] {
528 #[link(name = "c")]
529 #[link(name = "m")]
530 #[link(name = "bsd")]
531 #[link(name = "pthread")]
532 extern "C" {}
533 } else {
534 #[link(name = "c")]
535 #[link(name = "m")]
536 #[link(name = "rt")]
537 #[link(name = "pthread")]
538 extern "C" {}
539 }
540}
541
542missing! {
543 #[cfg_attr(feature = "extra_traits", derive(Debug))]
544 pub enum FILE {}
545 #[cfg_attr(feature = "extra_traits", derive(Debug))]
546 pub enum fpos_t {} }
548
549extern "C" {
550 pub fn isalnum(c: c_int) -> c_int;
551 pub fn isalpha(c: c_int) -> c_int;
552 pub fn iscntrl(c: c_int) -> c_int;
553 pub fn isdigit(c: c_int) -> c_int;
554 pub fn isgraph(c: c_int) -> c_int;
555 pub fn islower(c: c_int) -> c_int;
556 pub fn isprint(c: c_int) -> c_int;
557 pub fn ispunct(c: c_int) -> c_int;
558 pub fn isspace(c: c_int) -> c_int;
559 pub fn isupper(c: c_int) -> c_int;
560 pub fn isxdigit(c: c_int) -> c_int;
561 pub fn isblank(c: c_int) -> c_int;
562 pub fn tolower(c: c_int) -> c_int;
563 pub fn toupper(c: c_int) -> c_int;
564 pub fn qsort(
565 base: *mut c_void,
566 num: size_t,
567 size: size_t,
568 compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
569 );
570 pub fn bsearch(
571 key: *const c_void,
572 base: *const c_void,
573 num: size_t,
574 size: size_t,
575 compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
576 ) -> *mut c_void;
577 #[cfg_attr(
578 all(target_os = "macos", target_arch = "x86"),
579 link_name = "fopen$UNIX2003"
580 )]
581 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
582 #[cfg_attr(
583 all(target_os = "macos", target_arch = "x86"),
584 link_name = "freopen$UNIX2003"
585 )]
586 pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
587
588 pub fn fflush(file: *mut FILE) -> c_int;
589 pub fn fclose(file: *mut FILE) -> c_int;
590 pub fn remove(filename: *const c_char) -> c_int;
591 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
592 pub fn tmpfile() -> *mut FILE;
593 pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
594 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
595 pub fn getchar() -> c_int;
596 pub fn putchar(c: c_int) -> c_int;
597 pub fn fgetc(stream: *mut FILE) -> c_int;
598 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
599 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
600 #[cfg_attr(
601 all(target_os = "macos", target_arch = "x86"),
602 link_name = "fputs$UNIX2003"
603 )]
604 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
605 pub fn puts(s: *const c_char) -> c_int;
606 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
607 pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
608 #[cfg_attr(
609 all(target_os = "macos", target_arch = "x86"),
610 link_name = "fwrite$UNIX2003"
611 )]
612 pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
613 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
614 pub fn ftell(stream: *mut FILE) -> c_long;
615 pub fn rewind(stream: *mut FILE);
616 #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
617 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
618 #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
619 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
620 pub fn feof(stream: *mut FILE) -> c_int;
621 pub fn ferror(stream: *mut FILE) -> c_int;
622 pub fn clearerr(stream: *mut FILE);
623 pub fn perror(s: *const c_char);
624 pub fn atof(s: *const c_char) -> c_double;
625 pub fn atoi(s: *const c_char) -> c_int;
626 pub fn atol(s: *const c_char) -> c_long;
627 pub fn atoll(s: *const c_char) -> c_longlong;
628 #[cfg_attr(
629 all(target_os = "macos", target_arch = "x86"),
630 link_name = "strtod$UNIX2003"
631 )]
632 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
633 pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float;
634 pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
635 pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong;
636 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
637 pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong;
638 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
639 pub fn malloc(size: size_t) -> *mut c_void;
640 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
641 pub fn free(p: *mut c_void);
642 pub fn abort() -> !;
643 pub fn exit(status: c_int) -> !;
644 pub fn _exit(status: c_int) -> !;
645 #[cfg_attr(
646 all(target_os = "macos", target_arch = "x86"),
647 link_name = "system$UNIX2003"
648 )]
649 pub fn system(s: *const c_char) -> c_int;
650 pub fn getenv(s: *const c_char) -> *mut c_char;
651
652 pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
653 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
654 pub fn stpcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
655 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
656 pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
657 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
658 pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
659 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
660 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
661 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
662 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
663 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
664 pub fn strdup(cs: *const c_char) -> *mut c_char;
665 pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char;
666 pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
667 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
668 pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
669 pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
670 pub fn strlen(cs: *const c_char) -> size_t;
671 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
672 #[cfg_attr(
673 all(target_os = "macos", target_arch = "x86"),
674 link_name = "strerror$UNIX2003"
675 )]
676 pub fn strerror(n: c_int) -> *mut c_char;
677 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
678 pub fn strtok_r(s: *mut c_char, t: *const c_char, p: *mut *mut c_char) -> *mut c_char;
679 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
680 pub fn strsignal(sig: c_int) -> *mut c_char;
681 pub fn wcslen(buf: *const wchar_t) -> size_t;
682 pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> size_t;
683
684 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
685 pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t;
686 pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
687 pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
688 pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
689 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
690 pub fn memccpy(dest: *mut c_void, src: *const c_void, c: c_int, n: size_t) -> *mut c_void;
691}
692
693extern "C" {
694 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
695 pub fn getpwnam(name: *const c_char) -> *mut passwd;
696 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
697 pub fn getpwuid(uid: crate::uid_t) -> *mut passwd;
698
699 pub fn fprintf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
700 pub fn printf(format: *const c_char, ...) -> c_int;
701 pub fn snprintf(s: *mut c_char, n: size_t, format: *const c_char, ...) -> c_int;
702 pub fn sprintf(s: *mut c_char, format: *const c_char, ...) -> c_int;
703 #[cfg_attr(
704 all(target_os = "linux", not(target_env = "uclibc")),
705 link_name = "__isoc99_fscanf"
706 )]
707 pub fn fscanf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
708 #[cfg_attr(
709 all(target_os = "linux", not(target_env = "uclibc")),
710 link_name = "__isoc99_scanf"
711 )]
712 pub fn scanf(format: *const c_char, ...) -> c_int;
713 #[cfg_attr(
714 all(target_os = "linux", not(target_env = "uclibc")),
715 link_name = "__isoc99_sscanf"
716 )]
717 pub fn sscanf(s: *const c_char, format: *const c_char, ...) -> c_int;
718 pub fn getchar_unlocked() -> c_int;
719 pub fn putchar_unlocked(c: c_int) -> c_int;
720
721 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
722 #[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
723 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
724 #[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")]
725 #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
726 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
727 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
728 #[cfg_attr(
729 all(target_os = "macos", target_arch = "x86"),
730 link_name = "connect$UNIX2003"
731 )]
732 #[cfg_attr(
733 any(target_os = "illumos", target_os = "solaris"),
734 link_name = "__xnet_connect"
735 )]
736 #[cfg_attr(target_os = "espidf", link_name = "lwip_connect")]
737 pub fn connect(socket: c_int, address: *const sockaddr, len: socklen_t) -> c_int;
738 #[cfg_attr(
739 all(target_os = "macos", target_arch = "x86"),
740 link_name = "listen$UNIX2003"
741 )]
742 #[cfg_attr(target_os = "espidf", link_name = "lwip_listen")]
743 pub fn listen(socket: c_int, backlog: c_int) -> c_int;
744 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
745 #[cfg_attr(
746 all(target_os = "macos", target_arch = "x86"),
747 link_name = "accept$UNIX2003"
748 )]
749 #[cfg_attr(target_os = "espidf", link_name = "lwip_accept")]
750 pub fn accept(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> c_int;
751 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
752 #[cfg_attr(
753 all(target_os = "macos", target_arch = "x86"),
754 link_name = "getpeername$UNIX2003"
755 )]
756 #[cfg_attr(target_os = "espidf", link_name = "lwip_getpeername")]
757 pub fn getpeername(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t)
758 -> c_int;
759 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
760 #[cfg_attr(
761 all(target_os = "macos", target_arch = "x86"),
762 link_name = "getsockname$UNIX2003"
763 )]
764 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockname")]
765 pub fn getsockname(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t)
766 -> c_int;
767 #[cfg_attr(target_os = "espidf", link_name = "lwip_setsockopt")]
768 pub fn setsockopt(
769 socket: c_int,
770 level: c_int,
771 name: c_int,
772 value: *const c_void,
773 option_len: socklen_t,
774 ) -> c_int;
775 #[cfg_attr(
776 all(target_os = "macos", target_arch = "x86"),
777 link_name = "socketpair$UNIX2003"
778 )]
779 #[cfg_attr(
780 any(target_os = "illumos", target_os = "solaris"),
781 link_name = "__xnet_socketpair"
782 )]
783 pub fn socketpair(
784 domain: c_int,
785 type_: c_int,
786 protocol: c_int,
787 socket_vector: *mut c_int,
788 ) -> c_int;
789 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
790 #[cfg_attr(
791 all(target_os = "macos", target_arch = "x86"),
792 link_name = "sendto$UNIX2003"
793 )]
794 #[cfg_attr(
795 any(target_os = "illumos", target_os = "solaris"),
796 link_name = "__xnet_sendto"
797 )]
798 #[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")]
799 pub fn sendto(
800 socket: c_int,
801 buf: *const c_void,
802 len: size_t,
803 flags: c_int,
804 addr: *const sockaddr,
805 addrlen: socklen_t,
806 ) -> ssize_t;
807 #[cfg_attr(target_os = "espidf", link_name = "lwip_shutdown")]
808 pub fn shutdown(socket: c_int, how: c_int) -> c_int;
809
810 #[cfg_attr(
811 all(target_os = "macos", target_arch = "x86"),
812 link_name = "chmod$UNIX2003"
813 )]
814 pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
815 #[cfg_attr(
816 all(target_os = "macos", target_arch = "x86"),
817 link_name = "fchmod$UNIX2003"
818 )]
819 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
820
821 #[cfg_attr(
822 all(target_os = "macos", not(target_arch = "aarch64")),
823 link_name = "fstat$INODE64"
824 )]
825 #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
826 #[cfg_attr(
827 all(target_os = "freebsd", any(freebsd11, freebsd10)),
828 link_name = "fstat@FBSD_1.0"
829 )]
830 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
831
832 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
833
834 #[cfg_attr(
835 all(target_os = "macos", not(target_arch = "aarch64")),
836 link_name = "stat$INODE64"
837 )]
838 #[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
839 #[cfg_attr(
840 all(target_os = "freebsd", any(freebsd11, freebsd10)),
841 link_name = "stat@FBSD_1.0"
842 )]
843 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
844
845 pub fn pclose(stream: *mut crate::FILE) -> c_int;
846 #[cfg_attr(
847 all(target_os = "macos", target_arch = "x86"),
848 link_name = "fdopen$UNIX2003"
849 )]
850 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut crate::FILE;
851 pub fn fileno(stream: *mut crate::FILE) -> c_int;
852
853 #[cfg_attr(
854 all(target_os = "macos", target_arch = "x86"),
855 link_name = "open$UNIX2003"
856 )]
857 pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
858 #[cfg_attr(
859 all(target_os = "macos", target_arch = "x86"),
860 link_name = "creat$UNIX2003"
861 )]
862 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
863 #[cfg_attr(
864 all(target_os = "macos", target_arch = "x86"),
865 link_name = "fcntl$UNIX2003"
866 )]
867 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
868
869 #[cfg_attr(
870 all(target_os = "macos", target_arch = "x86_64"),
871 link_name = "opendir$INODE64"
872 )]
873 #[cfg_attr(
874 all(target_os = "macos", target_arch = "x86"),
875 link_name = "opendir$INODE64$UNIX2003"
876 )]
877 #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
878 pub fn opendir(dirname: *const c_char) -> *mut crate::DIR;
879
880 #[cfg_attr(
881 all(target_os = "macos", not(target_arch = "aarch64")),
882 link_name = "readdir$INODE64"
883 )]
884 #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
885 #[cfg_attr(
886 all(target_os = "freebsd", any(freebsd11, freebsd10)),
887 link_name = "readdir@FBSD_1.0"
888 )]
889 pub fn readdir(dirp: *mut crate::DIR) -> *mut crate::dirent;
890 #[cfg_attr(
891 all(target_os = "macos", target_arch = "x86"),
892 link_name = "closedir$UNIX2003"
893 )]
894 pub fn closedir(dirp: *mut crate::DIR) -> c_int;
895 #[cfg_attr(
896 all(target_os = "macos", target_arch = "x86_64"),
897 link_name = "rewinddir$INODE64"
898 )]
899 #[cfg_attr(
900 all(target_os = "macos", target_arch = "x86"),
901 link_name = "rewinddir$INODE64$UNIX2003"
902 )]
903 pub fn rewinddir(dirp: *mut crate::DIR);
904
905 pub fn fchmodat(
906 dirfd: c_int,
907 pathname: *const c_char,
908 mode: crate::mode_t,
909 flags: c_int,
910 ) -> c_int;
911 pub fn fchown(fd: c_int, owner: crate::uid_t, group: crate::gid_t) -> c_int;
912 pub fn fchownat(
913 dirfd: c_int,
914 pathname: *const c_char,
915 owner: crate::uid_t,
916 group: crate::gid_t,
917 flags: c_int,
918 ) -> c_int;
919 #[cfg_attr(
920 all(target_os = "macos", not(target_arch = "aarch64")),
921 link_name = "fstatat$INODE64"
922 )]
923 #[cfg_attr(
924 all(target_os = "freebsd", any(freebsd11, freebsd10)),
925 link_name = "fstatat@FBSD_1.1"
926 )]
927 pub fn fstatat(dirfd: c_int, pathname: *const c_char, buf: *mut stat, flags: c_int) -> c_int;
928 pub fn linkat(
929 olddirfd: c_int,
930 oldpath: *const c_char,
931 newdirfd: c_int,
932 newpath: *const c_char,
933 flags: c_int,
934 ) -> c_int;
935 pub fn renameat(
936 olddirfd: c_int,
937 oldpath: *const c_char,
938 newdirfd: c_int,
939 newpath: *const c_char,
940 ) -> c_int;
941 pub fn symlinkat(target: *const c_char, newdirfd: c_int, linkpath: *const c_char) -> c_int;
942 pub fn unlinkat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_int;
943
944 pub fn access(path: *const c_char, amode: c_int) -> c_int;
945 pub fn alarm(seconds: c_uint) -> c_uint;
946 pub fn chdir(dir: *const c_char) -> c_int;
947 pub fn fchdir(dirfd: c_int) -> c_int;
948 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int;
949 #[cfg_attr(
950 all(target_os = "macos", target_arch = "x86"),
951 link_name = "lchown$UNIX2003"
952 )]
953 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int;
954 #[cfg_attr(
955 all(target_os = "macos", target_arch = "x86"),
956 link_name = "close$NOCANCEL$UNIX2003"
957 )]
958 #[cfg_attr(
959 all(target_os = "macos", target_arch = "x86_64"),
960 link_name = "close$NOCANCEL"
961 )]
962 pub fn close(fd: c_int) -> c_int;
963 pub fn dup(fd: c_int) -> c_int;
964 pub fn dup2(src: c_int, dst: c_int) -> c_int;
965
966 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> c_int;
967 pub fn execle(path: *const c_char, arg0: *const c_char, ...) -> c_int;
968 pub fn execlp(file: *const c_char, arg0: *const c_char, ...) -> c_int;
969 pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> c_int;
970 pub fn execve(prog: *const c_char, argv: *const *mut c_char, envp: *const *mut c_char)
971 -> c_int;
972 pub fn execvp(c: *const c_char, argv: *const *mut c_char) -> c_int;
973
974 pub fn fork() -> pid_t;
975 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
976 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
977 pub fn getegid() -> gid_t;
978 pub fn geteuid() -> uid_t;
979 pub fn getgid() -> gid_t;
980 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t) -> c_int;
981 #[cfg_attr(target_os = "illumos", link_name = "getloginx")]
982 pub fn getlogin() -> *mut c_char;
983 #[cfg_attr(
984 all(target_os = "macos", target_arch = "x86"),
985 link_name = "getopt$UNIX2003"
986 )]
987 pub fn getopt(argc: c_int, argv: *const *mut c_char, optstr: *const c_char) -> c_int;
988 pub fn getpgid(pid: pid_t) -> pid_t;
989 pub fn getpgrp() -> pid_t;
990 pub fn getpid() -> pid_t;
991 pub fn getppid() -> pid_t;
992 pub fn getuid() -> uid_t;
993 pub fn isatty(fd: c_int) -> c_int;
994 #[cfg_attr(target_os = "solaris", link_name = "__link_xpg4")]
995 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
996 pub fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t;
997 pub fn pathconf(path: *const c_char, name: c_int) -> c_long;
998 pub fn pipe(fds: *mut c_int) -> c_int;
999 pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int;
1000 pub fn aligned_alloc(alignment: size_t, size: size_t) -> *mut c_void;
1001 #[cfg_attr(
1002 all(target_os = "macos", target_arch = "x86"),
1003 link_name = "read$UNIX2003"
1004 )]
1005 pub fn read(fd: c_int, buf: *mut c_void, count: size_t) -> ssize_t;
1006 pub fn rmdir(path: *const c_char) -> c_int;
1007 pub fn seteuid(uid: uid_t) -> c_int;
1008 pub fn setegid(gid: gid_t) -> c_int;
1009 pub fn setgid(gid: gid_t) -> c_int;
1010 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
1011 pub fn setsid() -> pid_t;
1012 pub fn setuid(uid: uid_t) -> c_int;
1013 pub fn setreuid(ruid: uid_t, euid: uid_t) -> c_int;
1014 pub fn setregid(rgid: gid_t, egid: gid_t) -> c_int;
1015 #[cfg_attr(
1016 all(target_os = "macos", target_arch = "x86"),
1017 link_name = "sleep$UNIX2003"
1018 )]
1019 pub fn sleep(secs: c_uint) -> c_uint;
1020 #[cfg_attr(
1021 all(target_os = "macos", target_arch = "x86"),
1022 link_name = "nanosleep$UNIX2003"
1023 )]
1024 #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
1025 pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> c_int;
1026 pub fn tcgetpgrp(fd: c_int) -> pid_t;
1027 pub fn tcsetpgrp(fd: c_int, pgrp: crate::pid_t) -> c_int;
1028 pub fn ttyname(fd: c_int) -> *mut c_char;
1029 #[cfg_attr(
1030 all(target_os = "macos", target_arch = "x86"),
1031 link_name = "ttyname_r$UNIX2003"
1032 )]
1033 #[cfg_attr(
1034 any(target_os = "illumos", target_os = "solaris"),
1035 link_name = "__posix_ttyname_r"
1036 )]
1037 pub fn ttyname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
1038 pub fn unlink(c: *const c_char) -> c_int;
1039 #[cfg_attr(
1040 all(target_os = "macos", target_arch = "x86"),
1041 link_name = "wait$UNIX2003"
1042 )]
1043 pub fn wait(status: *mut c_int) -> pid_t;
1044 #[cfg_attr(
1045 all(target_os = "macos", target_arch = "x86"),
1046 link_name = "waitpid$UNIX2003"
1047 )]
1048 pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) -> pid_t;
1049 #[cfg_attr(
1050 all(target_os = "macos", target_arch = "x86"),
1051 link_name = "write$UNIX2003"
1052 )]
1053 pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t;
1054 #[cfg_attr(
1055 all(target_os = "macos", target_arch = "x86"),
1056 link_name = "pread$UNIX2003"
1057 )]
1058 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t, offset: off_t) -> ssize_t;
1059 #[cfg_attr(
1060 all(target_os = "macos", target_arch = "x86"),
1061 link_name = "pwrite$UNIX2003"
1062 )]
1063 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t, offset: off_t) -> ssize_t;
1064 pub fn umask(mask: mode_t) -> mode_t;
1065
1066 #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
1067 pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
1068
1069 #[cfg_attr(
1070 all(target_os = "macos", target_arch = "x86"),
1071 link_name = "kill$UNIX2003"
1072 )]
1073 pub fn kill(pid: pid_t, sig: c_int) -> c_int;
1074 #[cfg_attr(
1075 all(target_os = "macos", target_arch = "x86"),
1076 link_name = "killpg$UNIX2003"
1077 )]
1078 pub fn killpg(pgrp: pid_t, sig: c_int) -> c_int;
1079
1080 pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
1081 pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
1082 pub fn mlockall(flags: c_int) -> c_int;
1083 pub fn munlockall() -> c_int;
1084
1085 #[cfg_attr(
1086 all(target_os = "macos", target_arch = "x86"),
1087 link_name = "mmap$UNIX2003"
1088 )]
1089 pub fn mmap(
1090 addr: *mut c_void,
1091 len: size_t,
1092 prot: c_int,
1093 flags: c_int,
1094 fd: c_int,
1095 offset: off_t,
1096 ) -> *mut c_void;
1097 #[cfg_attr(
1098 all(target_os = "macos", target_arch = "x86"),
1099 link_name = "munmap$UNIX2003"
1100 )]
1101 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
1102
1103 pub fn if_nametoindex(ifname: *const c_char) -> c_uint;
1104 pub fn if_indextoname(ifindex: c_uint, ifname: *mut c_char) -> *mut c_char;
1105
1106 #[cfg_attr(
1107 all(target_os = "macos", not(target_arch = "aarch64")),
1108 link_name = "lstat$INODE64"
1109 )]
1110 #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
1111 #[cfg_attr(
1112 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1113 link_name = "lstat@FBSD_1.0"
1114 )]
1115 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
1116
1117 #[cfg_attr(
1118 all(target_os = "macos", target_arch = "x86"),
1119 link_name = "fsync$UNIX2003"
1120 )]
1121 pub fn fsync(fd: c_int) -> c_int;
1122
1123 #[cfg_attr(
1124 all(target_os = "macos", target_arch = "x86"),
1125 link_name = "setenv$UNIX2003"
1126 )]
1127 pub fn setenv(name: *const c_char, val: *const c_char, overwrite: c_int) -> c_int;
1128 #[cfg_attr(
1129 all(target_os = "macos", target_arch = "x86"),
1130 link_name = "unsetenv$UNIX2003"
1131 )]
1132 #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
1133 pub fn unsetenv(name: *const c_char) -> c_int;
1134
1135 pub fn symlink(path1: *const c_char, path2: *const c_char) -> c_int;
1136
1137 pub fn truncate(path: *const c_char, length: off_t) -> c_int;
1138 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
1139
1140 pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t;
1141
1142 #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
1143 pub fn getrusage(resource: c_int, usage: *mut rusage) -> c_int;
1144
1145 #[cfg_attr(
1146 any(
1147 target_os = "macos",
1148 target_os = "ios",
1149 target_os = "tvos",
1150 target_os = "watchos",
1151 target_os = "visionos"
1152 ),
1153 link_name = "realpath$DARWIN_EXTSN"
1154 )]
1155 pub fn realpath(pathname: *const c_char, resolved: *mut c_char) -> *mut c_char;
1156
1157 #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
1158 pub fn times(buf: *mut crate::tms) -> crate::clock_t;
1159
1160 pub fn pthread_self() -> crate::pthread_t;
1161 pub fn pthread_equal(t1: crate::pthread_t, t2: crate::pthread_t) -> c_int;
1162 #[cfg_attr(
1163 all(target_os = "macos", target_arch = "x86"),
1164 link_name = "pthread_join$UNIX2003"
1165 )]
1166 pub fn pthread_join(native: crate::pthread_t, value: *mut *mut c_void) -> c_int;
1167 pub fn pthread_exit(value: *mut c_void) -> !;
1168 pub fn pthread_attr_init(attr: *mut crate::pthread_attr_t) -> c_int;
1169 pub fn pthread_attr_destroy(attr: *mut crate::pthread_attr_t) -> c_int;
1170 pub fn pthread_attr_getstacksize(
1171 attr: *const crate::pthread_attr_t,
1172 stacksize: *mut size_t,
1173 ) -> c_int;
1174 pub fn pthread_attr_setstacksize(attr: *mut crate::pthread_attr_t, stack_size: size_t)
1175 -> c_int;
1176 pub fn pthread_attr_setdetachstate(attr: *mut crate::pthread_attr_t, state: c_int) -> c_int;
1177 pub fn pthread_detach(thread: crate::pthread_t) -> c_int;
1178 #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
1179 pub fn sched_yield() -> c_int;
1180 pub fn pthread_key_create(
1181 key: *mut pthread_key_t,
1182 dtor: Option<unsafe extern "C" fn(*mut c_void)>,
1183 ) -> c_int;
1184 pub fn pthread_key_delete(key: pthread_key_t) -> c_int;
1185 pub fn pthread_getspecific(key: pthread_key_t) -> *mut c_void;
1186 pub fn pthread_setspecific(key: pthread_key_t, value: *const c_void) -> c_int;
1187 pub fn pthread_mutex_init(
1188 lock: *mut pthread_mutex_t,
1189 attr: *const pthread_mutexattr_t,
1190 ) -> c_int;
1191 pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> c_int;
1192 pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> c_int;
1193 pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> c_int;
1194 pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> c_int;
1195
1196 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int;
1197 #[cfg_attr(
1198 all(target_os = "macos", target_arch = "x86"),
1199 link_name = "pthread_mutexattr_destroy$UNIX2003"
1200 )]
1201 pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int;
1202 pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: c_int) -> c_int;
1203
1204 #[cfg_attr(
1205 all(target_os = "macos", target_arch = "x86"),
1206 link_name = "pthread_cond_init$UNIX2003"
1207 )]
1208 pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> c_int;
1209 #[cfg_attr(
1210 all(target_os = "macos", target_arch = "x86"),
1211 link_name = "pthread_cond_wait$UNIX2003"
1212 )]
1213 pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> c_int;
1214 #[cfg_attr(
1215 all(target_os = "macos", target_arch = "x86"),
1216 link_name = "pthread_cond_timedwait$UNIX2003"
1217 )]
1218 pub fn pthread_cond_timedwait(
1219 cond: *mut pthread_cond_t,
1220 lock: *mut pthread_mutex_t,
1221 abstime: *const crate::timespec,
1222 ) -> c_int;
1223 pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> c_int;
1224 pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> c_int;
1225 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int;
1226 pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> c_int;
1227 pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> c_int;
1228 #[cfg_attr(
1229 all(target_os = "macos", target_arch = "x86"),
1230 link_name = "pthread_rwlock_init$UNIX2003"
1231 )]
1232 pub fn pthread_rwlock_init(
1233 lock: *mut pthread_rwlock_t,
1234 attr: *const pthread_rwlockattr_t,
1235 ) -> c_int;
1236 #[cfg_attr(
1237 all(target_os = "macos", target_arch = "x86"),
1238 link_name = "pthread_rwlock_destroy$UNIX2003"
1239 )]
1240 pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> c_int;
1241 #[cfg_attr(
1242 all(target_os = "macos", target_arch = "x86"),
1243 link_name = "pthread_rwlock_rdlock$UNIX2003"
1244 )]
1245 pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> c_int;
1246 #[cfg_attr(
1247 all(target_os = "macos", target_arch = "x86"),
1248 link_name = "pthread_rwlock_tryrdlock$UNIX2003"
1249 )]
1250 pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> c_int;
1251 #[cfg_attr(
1252 all(target_os = "macos", target_arch = "x86"),
1253 link_name = "pthread_rwlock_wrlock$UNIX2003"
1254 )]
1255 pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> c_int;
1256 #[cfg_attr(
1257 all(target_os = "macos", target_arch = "x86"),
1258 link_name = "pthread_rwlock_trywrlock$UNIX2003"
1259 )]
1260 pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> c_int;
1261 #[cfg_attr(
1262 all(target_os = "macos", target_arch = "x86"),
1263 link_name = "pthread_rwlock_unlock$UNIX2003"
1264 )]
1265 pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> c_int;
1266 pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> c_int;
1267 pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> c_int;
1268
1269 #[cfg_attr(
1270 any(target_os = "illumos", target_os = "solaris"),
1271 link_name = "__xnet_getsockopt"
1272 )]
1273 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")]
1274 pub fn getsockopt(
1275 sockfd: c_int,
1276 level: c_int,
1277 optname: c_int,
1278 optval: *mut c_void,
1279 optlen: *mut crate::socklen_t,
1280 ) -> c_int;
1281 pub fn raise(signum: c_int) -> c_int;
1282
1283 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
1284 pub fn utimes(filename: *const c_char, times: *const crate::timeval) -> c_int;
1285 pub fn dlopen(filename: *const c_char, flag: c_int) -> *mut c_void;
1286 pub fn dlerror() -> *mut c_char;
1287 pub fn dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void;
1288 pub fn dlclose(handle: *mut c_void) -> c_int;
1289
1290 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
1291 #[cfg_attr(
1292 any(target_os = "illumos", target_os = "solaris"),
1293 link_name = "__xnet_getaddrinfo"
1294 )]
1295 #[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")]
1296 pub fn getaddrinfo(
1297 node: *const c_char,
1298 service: *const c_char,
1299 hints: *const addrinfo,
1300 res: *mut *mut addrinfo,
1301 ) -> c_int;
1302 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
1303 #[cfg_attr(target_os = "espidf", link_name = "lwip_freeaddrinfo")]
1304 pub fn freeaddrinfo(res: *mut addrinfo);
1305 pub fn hstrerror(errcode: c_int) -> *const c_char;
1306 pub fn gai_strerror(errcode: c_int) -> *const c_char;
1307 #[cfg_attr(
1308 any(
1309 all(
1310 target_os = "linux",
1311 not(any(target_env = "musl", target_env = "ohos"))
1312 ),
1313 target_os = "freebsd",
1314 target_os = "cygwin",
1315 target_os = "dragonfly",
1316 target_os = "haiku"
1317 ),
1318 link_name = "__res_init"
1319 )]
1320 #[cfg_attr(
1321 any(
1322 target_os = "macos",
1323 target_os = "ios",
1324 target_os = "tvos",
1325 target_os = "watchos",
1326 target_os = "visionos"
1327 ),
1328 link_name = "res_9_init"
1329 )]
1330 pub fn res_init() -> c_int;
1331
1332 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
1333 #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1334 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1336 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
1337 #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1338 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1340 #[cfg_attr(
1341 all(target_os = "macos", target_arch = "x86"),
1342 link_name = "mktime$UNIX2003"
1343 )]
1344 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
1345 #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1346 pub fn mktime(tm: *mut tm) -> time_t;
1348 #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
1349 #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1350 pub fn time(time: *mut time_t) -> time_t;
1352 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
1353 #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1354 pub fn gmtime(time_p: *const time_t) -> *mut tm;
1356 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
1357 #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1358 pub fn localtime(time_p: *const time_t) -> *mut tm;
1360 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
1361 #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1362 pub fn difftime(time1: time_t, time0: time_t) -> c_double;
1364 #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
1365 #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1366 pub fn timegm(tm: *mut crate::tm) -> time_t;
1368
1369 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
1370 #[cfg_attr(
1371 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1372 link_name = "mknod@FBSD_1.0"
1373 )]
1374 pub fn mknod(pathname: *const c_char, mode: crate::mode_t, dev: crate::dev_t) -> c_int;
1375 pub fn gethostname(name: *mut c_char, len: size_t) -> c_int;
1376 pub fn endservent();
1377 pub fn getservbyname(name: *const c_char, proto: *const c_char) -> *mut servent;
1378 pub fn getservbyport(port: c_int, proto: *const c_char) -> *mut servent;
1379 pub fn getservent() -> *mut servent;
1380 pub fn setservent(stayopen: c_int);
1381 pub fn getprotobyname(name: *const c_char) -> *mut protoent;
1382 pub fn getprotobynumber(proto: c_int) -> *mut protoent;
1383 pub fn chroot(name: *const c_char) -> c_int;
1384 #[cfg(target_os = "cygwin")]
1385 pub fn usleep(secs: useconds_t) -> c_int;
1386 #[cfg_attr(
1387 all(target_os = "macos", target_arch = "x86"),
1388 link_name = "usleep$UNIX2003"
1389 )]
1390 #[cfg(not(target_os = "cygwin"))]
1391 pub fn usleep(secs: c_uint) -> c_int;
1392 #[cfg_attr(
1393 all(target_os = "macos", target_arch = "x86"),
1394 link_name = "send$UNIX2003"
1395 )]
1396 #[cfg_attr(target_os = "espidf", link_name = "lwip_send")]
1397 pub fn send(socket: c_int, buf: *const c_void, len: size_t, flags: c_int) -> ssize_t;
1398 #[cfg_attr(
1399 all(target_os = "macos", target_arch = "x86"),
1400 link_name = "recv$UNIX2003"
1401 )]
1402 #[cfg_attr(target_os = "espidf", link_name = "lwip_recv")]
1403 pub fn recv(socket: c_int, buf: *mut c_void, len: size_t, flags: c_int) -> ssize_t;
1404 #[cfg_attr(
1405 all(target_os = "macos", target_arch = "x86"),
1406 link_name = "putenv$UNIX2003"
1407 )]
1408 #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
1409 pub fn putenv(string: *mut c_char) -> c_int;
1410 #[cfg_attr(
1411 all(target_os = "macos", target_arch = "x86"),
1412 link_name = "poll$UNIX2003"
1413 )]
1414 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int;
1415 #[cfg_attr(
1416 all(target_os = "macos", target_arch = "x86_64"),
1417 link_name = "select$1050"
1418 )]
1419 #[cfg_attr(
1420 all(target_os = "macos", target_arch = "x86"),
1421 link_name = "select$UNIX2003"
1422 )]
1423 #[cfg_attr(target_os = "netbsd", link_name = "__select50")]
1424 pub fn select(
1425 nfds: c_int,
1426 readfds: *mut fd_set,
1427 writefds: *mut fd_set,
1428 errorfds: *mut fd_set,
1429 timeout: *mut timeval,
1430 ) -> c_int;
1431 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
1432 pub fn setlocale(category: c_int, locale: *const c_char) -> *mut c_char;
1433 pub fn localeconv() -> *mut lconv;
1434
1435 #[cfg_attr(
1436 all(target_os = "macos", target_arch = "x86"),
1437 link_name = "sem_wait$UNIX2003"
1438 )]
1439 pub fn sem_wait(sem: *mut sem_t) -> c_int;
1440 pub fn sem_trywait(sem: *mut sem_t) -> c_int;
1441 pub fn sem_post(sem: *mut sem_t) -> c_int;
1442 pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> c_int;
1443 pub fn fstatvfs(fd: c_int, buf: *mut statvfs) -> c_int;
1444
1445 #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
1446 pub fn sigemptyset(set: *mut sigset_t) -> c_int;
1447 #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
1448 pub fn sigaddset(set: *mut sigset_t, signum: c_int) -> c_int;
1449 #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
1450 pub fn sigfillset(set: *mut sigset_t) -> c_int;
1451 #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
1452 pub fn sigdelset(set: *mut sigset_t, signum: c_int) -> c_int;
1453 #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
1454 pub fn sigismember(set: *const sigset_t, signum: c_int) -> c_int;
1455
1456 #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
1457 pub fn sigprocmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int;
1458 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
1459 pub fn sigpending(set: *mut sigset_t) -> c_int;
1460
1461 #[cfg_attr(target_os = "solaris", link_name = "__sysconf_xpg7")]
1462 pub fn sysconf(name: c_int) -> c_long;
1463
1464 pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
1465
1466 pub fn fseeko(stream: *mut crate::FILE, offset: off_t, whence: c_int) -> c_int;
1467 pub fn ftello(stream: *mut crate::FILE) -> off_t;
1468 #[cfg_attr(
1469 all(target_os = "macos", target_arch = "x86"),
1470 link_name = "tcdrain$UNIX2003"
1471 )]
1472 pub fn tcdrain(fd: c_int) -> c_int;
1473 pub fn cfgetispeed(termios: *const crate::termios) -> crate::speed_t;
1474 pub fn cfgetospeed(termios: *const crate::termios) -> crate::speed_t;
1475 pub fn cfsetispeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
1476 pub fn cfsetospeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
1477 pub fn tcgetattr(fd: c_int, termios: *mut crate::termios) -> c_int;
1478 pub fn tcsetattr(fd: c_int, optional_actions: c_int, termios: *const crate::termios) -> c_int;
1479 pub fn tcflow(fd: c_int, action: c_int) -> c_int;
1480 pub fn tcflush(fd: c_int, action: c_int) -> c_int;
1481 pub fn tcgetsid(fd: c_int) -> crate::pid_t;
1482 pub fn tcsendbreak(fd: c_int, duration: c_int) -> c_int;
1483 pub fn mkstemp(template: *mut c_char) -> c_int;
1484 pub fn mkdtemp(template: *mut c_char) -> *mut c_char;
1485
1486 pub fn tmpnam(ptr: *mut c_char) -> *mut c_char;
1487
1488 pub fn openlog(ident: *const c_char, logopt: c_int, facility: c_int);
1489 pub fn closelog();
1490 pub fn setlogmask(maskpri: c_int) -> c_int;
1491 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
1492 pub fn syslog(priority: c_int, message: *const c_char, ...);
1493 #[cfg_attr(
1494 all(target_os = "macos", target_arch = "x86"),
1495 link_name = "nice$UNIX2003"
1496 )]
1497 pub fn nice(incr: c_int) -> c_int;
1498
1499 pub fn grantpt(fd: c_int) -> c_int;
1500 pub fn posix_openpt(flags: c_int) -> c_int;
1501 pub fn ptsname(fd: c_int) -> *mut c_char;
1502 pub fn unlockpt(fd: c_int) -> c_int;
1503
1504 pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
1505 pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
1506
1507 pub fn lockf(fd: c_int, cmd: c_int, len: off_t) -> c_int;
1508
1509}
1510
1511safe_f! {
1512 pub {const} fn htonl(hostlong: u32) -> u32 {
1515 u32::to_be(hostlong)
1516 }
1517 pub {const} fn htons(hostshort: u16) -> u16 {
1518 u16::to_be(hostshort)
1519 }
1520 pub {const} fn ntohl(netlong: u32) -> u32 {
1521 u32::from_be(netlong)
1522 }
1523 pub {const} fn ntohs(netshort: u16) -> u16 {
1524 u16::from_be(netshort)
1525 }
1526}
1527
1528cfg_if! {
1529 if #[cfg(not(any(
1530 target_os = "emscripten",
1531 target_os = "android",
1532 target_os = "haiku",
1533 target_os = "nto",
1534 target_os = "solaris",
1535 target_os = "cygwin"
1536 )))] {
1537 extern "C" {
1538 pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> c_int;
1539 }
1540 } else if #[cfg(target_os = "solaris")] {
1541 extern "C" {
1542 pub fn adjtime(delta: *mut timeval, olddelta: *mut timeval) -> c_int;
1543 }
1544 }
1545}
1546
1547cfg_if! {
1548 if #[cfg(not(any(
1549 target_os = "emscripten",
1550 target_os = "android",
1551 target_os = "nto"
1552 )))] {
1553 extern "C" {
1554 pub fn stpncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
1555 }
1556 }
1557}
1558
1559cfg_if! {
1560 if #[cfg(not(target_os = "android"))] {
1561 extern "C" {
1562 #[cfg_attr(
1563 all(target_os = "macos", target_arch = "x86"),
1564 link_name = "confstr$UNIX2003"
1565 )]
1566 #[cfg_attr(target_os = "solaris", link_name = "__confstr_xpg7")]
1567 pub fn confstr(name: c_int, buf: *mut c_char, len: size_t) -> size_t;
1568 }
1569 }
1570}
1571
1572cfg_if! {
1573 if #[cfg(not(target_os = "aix"))] {
1574 extern "C" {
1575 pub fn dladdr(addr: *const c_void, info: *mut Dl_info) -> c_int;
1576 }
1577 }
1578}
1579
1580cfg_if! {
1581 if #[cfg(not(target_os = "solaris"))] {
1582 extern "C" {
1583 pub fn flock(fd: c_int, operation: c_int) -> c_int;
1584 }
1585 }
1586}
1587
1588cfg_if! {
1589 if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] {
1590 extern "C" {
1591 pub fn open_wmemstream(ptr: *mut *mut wchar_t, sizeloc: *mut size_t) -> *mut FILE;
1592 }
1593 }
1594}
1595
1596cfg_if! {
1597 if #[cfg(not(target_os = "redox"))] {
1598 extern "C" {
1599 pub fn getsid(pid: pid_t) -> pid_t;
1600 #[cfg_attr(
1601 all(target_os = "macos", target_arch = "x86"),
1602 link_name = "pause$UNIX2003"
1603 )]
1604 pub fn pause() -> c_int;
1605
1606 pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
1607 pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int;
1608
1609 #[cfg_attr(
1610 all(target_os = "macos", target_arch = "x86_64"),
1611 link_name = "fdopendir$INODE64"
1612 )]
1613 #[cfg_attr(
1614 all(target_os = "macos", target_arch = "x86"),
1615 link_name = "fdopendir$INODE64$UNIX2003"
1616 )]
1617 pub fn fdopendir(fd: c_int) -> *mut crate::DIR;
1618
1619 #[cfg_attr(
1620 all(target_os = "macos", not(target_arch = "aarch64")),
1621 link_name = "readdir_r$INODE64"
1622 )]
1623 #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
1624 #[cfg_attr(
1625 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1626 link_name = "readdir_r@FBSD_1.0"
1627 )]
1628 #[allow(non_autolinks)] pub fn readdir_r(
1636 dirp: *mut crate::DIR,
1637 entry: *mut crate::dirent,
1638 result: *mut *mut crate::dirent,
1639 ) -> c_int;
1640 }
1641 }
1642}
1643
1644cfg_if! {
1645 if #[cfg(target_os = "nto")] {
1646 extern "C" {
1647 pub fn readlinkat(
1648 dirfd: c_int,
1649 pathname: *const c_char,
1650 buf: *mut c_char,
1651 bufsiz: size_t,
1652 ) -> c_int;
1653 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: size_t) -> c_int;
1654 pub fn pselect(
1655 nfds: c_int,
1656 readfds: *mut fd_set,
1657 writefds: *mut fd_set,
1658 errorfds: *mut fd_set,
1659 timeout: *mut timespec,
1660 sigmask: *const sigset_t,
1661 ) -> c_int;
1662 pub fn sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction)
1663 -> c_int;
1664 }
1665 } else {
1666 extern "C" {
1667 pub fn readlinkat(
1668 dirfd: c_int,
1669 pathname: *const c_char,
1670 buf: *mut c_char,
1671 bufsiz: size_t,
1672 ) -> ssize_t;
1673 pub fn fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE;
1674 pub fn open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE;
1675 pub fn atexit(cb: extern "C" fn()) -> c_int;
1676 #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
1677 pub fn sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction)
1678 -> c_int;
1679 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: size_t) -> ssize_t;
1680 #[cfg_attr(
1681 all(target_os = "macos", target_arch = "x86_64"),
1682 link_name = "pselect$1050"
1683 )]
1684 #[cfg_attr(
1685 all(target_os = "macos", target_arch = "x86"),
1686 link_name = "pselect$UNIX2003"
1687 )]
1688 #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
1689 pub fn pselect(
1690 nfds: c_int,
1691 readfds: *mut fd_set,
1692 writefds: *mut fd_set,
1693 errorfds: *mut fd_set,
1694 timeout: *const timespec,
1695 sigmask: *const sigset_t,
1696 ) -> c_int;
1697 }
1698 }
1699}
1700
1701cfg_if! {
1702 if #[cfg(not(any(
1703 target_os = "solaris",
1704 target_os = "illumos",
1705 target_os = "nto",
1706 )))] {
1707 extern "C" {
1708 pub fn cfmakeraw(termios: *mut crate::termios);
1709 pub fn cfsetspeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
1710 }
1711 }
1712}
1713
1714extern "C" {
1715 pub fn fnmatch(pattern: *const c_char, name: *const c_char, flags: c_int) -> c_int;
1716}
1717
1718cfg_if! {
1719 if #[cfg(target_env = "newlib")] {
1720 mod newlib;
1721 pub use self::newlib::*;
1722 } else if #[cfg(any(
1723 target_os = "linux",
1724 target_os = "l4re",
1725 target_os = "android",
1726 target_os = "emscripten"
1727 ))] {
1728 mod linux_like;
1729 pub use self::linux_like::*;
1730 } else if #[cfg(any(
1731 target_os = "macos",
1732 target_os = "ios",
1733 target_os = "tvos",
1734 target_os = "watchos",
1735 target_os = "visionos",
1736 target_os = "freebsd",
1737 target_os = "dragonfly",
1738 target_os = "openbsd",
1739 target_os = "netbsd"
1740 ))] {
1741 mod bsd;
1742 pub use self::bsd::*;
1743 } else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] {
1744 mod solarish;
1745 pub use self::solarish::*;
1746 } else if #[cfg(target_os = "haiku")] {
1747 mod haiku;
1748 pub use self::haiku::*;
1749 } else if #[cfg(target_os = "redox")] {
1750 mod redox;
1751 pub use self::redox::*;
1752 } else if #[cfg(target_os = "cygwin")] {
1753 mod cygwin;
1754 pub use self::cygwin::*;
1755 } else if #[cfg(target_os = "nto")] {
1756 mod nto;
1757 pub use self::nto::*;
1758 } else if #[cfg(target_os = "aix")] {
1759 mod aix;
1760 pub use self::aix::*;
1761 } else if #[cfg(target_os = "hurd")] {
1762 mod hurd;
1763 pub use self::hurd::*;
1764 } else if #[cfg(target_os = "nuttx")] {
1765 mod nuttx;
1766 pub use self::nuttx::*;
1767 } else {
1768 }
1770}