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