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
40extern_ty! {
41 pub enum DIR {}
42}
43
44#[cfg(not(target_os = "nuttx"))]
45pub type locale_t = *mut c_void;
46
47s! {
48 pub struct group {
49 pub gr_name: *mut c_char,
50 pub gr_passwd: *mut c_char,
51 pub gr_gid: crate::gid_t,
52 pub gr_mem: *mut *mut c_char,
53 }
54
55 pub struct utimbuf {
56 pub actime: time_t,
57 pub modtime: time_t,
58 }
59
60 #[derive(Default)]
61 pub struct timeval {
62 pub tv_sec: time_t,
63 #[cfg(not(gnu_time_bits64))]
64 pub tv_usec: crate::suseconds_t,
65 #[cfg(gnu_time_bits64)]
68 pub tv_usec: __suseconds64_t,
69 }
70
71 #[derive(Default)]
74 #[cfg(not(target_env = "gnu"))]
75 pub struct timespec {
76 pub tv_sec: time_t,
77 #[cfg(all(musl32_time64, target_endian = "big"))]
78 __pad0: Padding<u32>,
79 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
80 pub tv_nsec: i64,
81 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
82 pub tv_nsec: c_long,
83 #[cfg(all(musl32_time64, target_endian = "little"))]
84 __pad0: Padding<u32>,
85 }
86
87 pub struct rlimit {
88 pub rlim_cur: rlim_t,
89 pub rlim_max: rlim_t,
90 }
91
92 pub struct rusage {
93 pub ru_utime: timeval,
94 pub ru_stime: timeval,
95 pub ru_maxrss: c_long,
96 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
97 __pad1: Padding<u32>,
98 pub ru_ixrss: c_long,
99 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
100 __pad2: Padding<u32>,
101 pub ru_idrss: c_long,
102 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
103 __pad3: Padding<u32>,
104 pub ru_isrss: c_long,
105 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
106 __pad4: Padding<u32>,
107 pub ru_minflt: c_long,
108 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
109 __pad5: Padding<u32>,
110 pub ru_majflt: c_long,
111 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
112 __pad6: Padding<u32>,
113 pub ru_nswap: c_long,
114 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
115 __pad7: Padding<u32>,
116 pub ru_inblock: c_long,
117 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
118 __pad8: Padding<u32>,
119 pub ru_oublock: c_long,
120 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
121 __pad9: Padding<u32>,
122 pub ru_msgsnd: c_long,
123 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
124 __pad10: Padding<u32>,
125 pub ru_msgrcv: c_long,
126 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
127 __pad11: Padding<u32>,
128 pub ru_nsignals: c_long,
129 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
130 __pad12: Padding<u32>,
131 pub ru_nvcsw: c_long,
132 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
133 __pad13: Padding<u32>,
134 pub ru_nivcsw: c_long,
135 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
136 __pad14: Padding<u32>,
137
138 #[cfg(any(target_env = "musl", target_env = "ohos", target_os = "emscripten"))]
139 __reserved: Padding<[c_long; 16]>,
140 }
141
142 #[cfg(not(target_os = "nuttx"))]
143 pub struct ipv6_mreq {
144 pub ipv6mr_multiaddr: in6_addr,
145 #[cfg(target_os = "android")]
146 pub ipv6mr_interface: c_int,
147 #[cfg(not(target_os = "android"))]
148 pub ipv6mr_interface: c_uint,
149 }
150
151 #[cfg(all(not(target_os = "cygwin"), not(target_os = "horizon")))]
152 pub struct hostent {
153 pub h_name: *mut c_char,
154 pub h_aliases: *mut *mut c_char,
155 pub h_addrtype: c_int,
156 pub h_length: c_int,
157 pub h_addr_list: *mut *mut c_char,
158 }
159
160 pub struct iovec {
161 pub iov_base: *mut c_void,
162 pub iov_len: size_t,
163 }
164
165 #[cfg(not(target_os = "horizon"))]
166 pub struct pollfd {
167 pub fd: c_int,
168 pub events: c_short,
169 pub revents: c_short,
170 }
171
172 pub struct winsize {
173 pub ws_row: c_ushort,
174 pub ws_col: c_ushort,
175 pub ws_xpixel: c_ushort,
176 pub ws_ypixel: c_ushort,
177 }
178
179 #[cfg(not(target_os = "cygwin"))]
180 pub struct linger {
181 pub l_onoff: c_int,
182 pub l_linger: c_int,
183 }
184
185 pub struct sigval {
186 pub sival_ptr: *mut c_void,
188 }
189
190 pub struct itimerval {
192 pub it_interval: crate::timeval,
193 pub it_value: crate::timeval,
194 }
195
196 pub struct tms {
198 pub tms_utime: crate::clock_t,
199 pub tms_stime: crate::clock_t,
200 pub tms_cutime: crate::clock_t,
201 pub tms_cstime: crate::clock_t,
202 }
203
204 pub struct servent {
205 pub s_name: *mut c_char,
206 pub s_aliases: *mut *mut c_char,
207 #[cfg(target_os = "cygwin")]
208 pub s_port: c_short,
209 #[cfg(not(target_os = "cygwin"))]
210 pub s_port: c_int,
211 pub s_proto: *mut c_char,
212 }
213
214 pub struct protoent {
215 pub p_name: *mut c_char,
216 pub p_aliases: *mut *mut c_char,
217 #[cfg(not(target_os = "cygwin"))]
218 pub p_proto: c_int,
219 #[cfg(target_os = "cygwin")]
220 pub p_proto: c_short,
221 }
222
223 #[repr(align(4))]
224 pub struct in6_addr {
225 pub s6_addr: [u8; 16],
226 }
227}
228
229pub const INT_MIN: c_int = -2147483648;
230pub const INT_MAX: c_int = 2147483647;
231
232pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
233pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
234pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
235
236cfg_if! {
237 if #[cfg(all(not(target_os = "nto"), not(target_os = "aix")))] {
238 pub const DT_UNKNOWN: u8 = 0;
239 pub const DT_FIFO: u8 = 1;
240 pub const DT_CHR: u8 = 2;
241 pub const DT_DIR: u8 = 4;
242 pub const DT_BLK: u8 = 6;
243 pub const DT_REG: u8 = 8;
244 pub const DT_LNK: u8 = 10;
245 pub const DT_SOCK: u8 = 12;
246 }
247}
248cfg_if! {
249 if #[cfg(not(target_os = "redox"))] {
250 pub const FD_CLOEXEC: c_int = 0x1;
251 }
252}
253
254cfg_if! {
255 if #[cfg(not(any(target_os = "nto", target_os = "l4re")))] {
256 pub const USRQUOTA: c_int = 0;
257 pub const GRPQUOTA: c_int = 1;
258 }
259}
260pub const SIGIOT: c_int = 6;
261
262pub const S_ISUID: mode_t = 0o4000;
263pub const S_ISGID: mode_t = 0o2000;
264pub const S_ISVTX: mode_t = 0o1000;
265
266cfg_if! {
267 if #[cfg(not(any(
268 target_os = "haiku",
269 target_os = "illumos",
270 target_os = "solaris",
271 target_os = "cygwin"
272 )))] {
273 pub const IF_NAMESIZE: size_t = 16;
274 pub const IFNAMSIZ: size_t = IF_NAMESIZE;
275 }
276}
277
278pub const LOG_EMERG: c_int = 0;
279pub const LOG_ALERT: c_int = 1;
280pub const LOG_CRIT: c_int = 2;
281pub const LOG_ERR: c_int = 3;
282pub const LOG_WARNING: c_int = 4;
283pub const LOG_NOTICE: c_int = 5;
284pub const LOG_INFO: c_int = 6;
285pub const LOG_DEBUG: c_int = 7;
286
287pub const LOG_KERN: c_int = 0;
288pub const LOG_USER: c_int = 1 << 3;
289pub const LOG_MAIL: c_int = 2 << 3;
290pub const LOG_DAEMON: c_int = 3 << 3;
291pub const LOG_AUTH: c_int = 4 << 3;
292pub const LOG_SYSLOG: c_int = 5 << 3;
293pub const LOG_LPR: c_int = 6 << 3;
294pub const LOG_NEWS: c_int = 7 << 3;
295pub const LOG_UUCP: c_int = 8 << 3;
296pub const LOG_LOCAL0: c_int = 16 << 3;
297pub const LOG_LOCAL1: c_int = 17 << 3;
298pub const LOG_LOCAL2: c_int = 18 << 3;
299pub const LOG_LOCAL3: c_int = 19 << 3;
300pub const LOG_LOCAL4: c_int = 20 << 3;
301pub const LOG_LOCAL5: c_int = 21 << 3;
302pub const LOG_LOCAL6: c_int = 22 << 3;
303pub const LOG_LOCAL7: c_int = 23 << 3;
304
305cfg_if! {
306 if #[cfg(not(target_os = "haiku"))] {
307 pub const LOG_PID: c_int = 0x01;
308 pub const LOG_CONS: c_int = 0x02;
309 pub const LOG_ODELAY: c_int = 0x04;
310 pub const LOG_NDELAY: c_int = 0x08;
311 pub const LOG_NOWAIT: c_int = 0x10;
312 }
313}
314pub const LOG_PRIMASK: c_int = 7;
315pub const LOG_FACMASK: c_int = 0x3f8;
316
317cfg_if! {
318 if #[cfg(not(target_os = "nto"))] {
319 pub const PRIO_MIN: c_int = -20;
320 pub const PRIO_MAX: c_int = 20;
321 }
322}
323pub const IPPROTO_ICMP: c_int = 1;
324pub const IPPROTO_ICMPV6: c_int = 58;
325pub const IPPROTO_TCP: c_int = 6;
326pub const IPPROTO_UDP: c_int = 17;
327pub const IPPROTO_IP: c_int = 0;
328pub const IPPROTO_IPV6: c_int = 41;
329
330pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
331pub const INADDR_ANY: in_addr_t = 0;
332pub const INADDR_BROADCAST: in_addr_t = 4294967295;
333pub const INADDR_NONE: in_addr_t = 4294967295;
334
335pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr {
336 s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
337};
338
339pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr {
340 s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
341};
342
343pub const ARPOP_REQUEST: u16 = 1;
344pub const ARPOP_REPLY: u16 = 2;
345
346pub const ATF_COM: c_int = 0x02;
347pub const ATF_PERM: c_int = 0x04;
348pub const ATF_PUBL: c_int = 0x08;
349pub const ATF_USETRAILERS: c_int = 0x10;
350
351cfg_if! {
352 if #[cfg(any(target_os = "nto", target_os = "aix"))] {
353 pub const FNM_PERIOD: c_int = 1 << 1;
354 } else {
355 pub const FNM_PERIOD: c_int = 1 << 2;
356 }
357}
358pub const FNM_NOMATCH: c_int = 1;
359
360cfg_if! {
361 if #[cfg(any(
362 target_os = "illumos",
363 target_os = "solaris",
364 target_os = "netbsd"
365 ))] {
366 pub const FNM_CASEFOLD: c_int = 1 << 3;
367 } else if #[cfg(not(target_os = "aix"))] {
368 pub const FNM_CASEFOLD: c_int = 1 << 4;
369 }
370}
371
372cfg_if! {
373 if #[cfg(any(
374 target_os = "macos",
375 target_os = "freebsd",
376 target_os = "android",
377 target_os = "openbsd",
378 target_os = "cygwin",
379 target_os = "netbsd",
380 ))] {
381 pub const FNM_PATHNAME: c_int = 1 << 1;
382 } else {
383 pub const FNM_PATHNAME: c_int = 1 << 0;
384 }
385}
386
387cfg_if! {
388 if #[cfg(any(
389 target_os = "macos",
390 target_os = "freebsd",
391 target_os = "android",
392 target_os = "openbsd",
393 target_os = "netbsd",
394 target_os = "cygwin",
395 ))] {
396 pub const FNM_NOESCAPE: c_int = 1 << 0;
397 } else if #[cfg(target_os = "nto")] {
398 pub const FNM_NOESCAPE: c_int = 1 << 2;
399 } else if #[cfg(target_os = "aix")] {
400 pub const FNM_NOESCAPE: c_int = 1 << 3;
401 } else {
402 pub const FNM_NOESCAPE: c_int = 1 << 1;
403 }
404}
405
406extern "C" {
407 pub static in6addr_loopback: in6_addr;
408 pub static in6addr_any: in6_addr;
409}
410
411cfg_if! {
412 if #[cfg(any(
413 target_os = "l4re",
414 target_os = "espidf",
415 target_os = "nuttx"
416 ))] {
417 } else if #[cfg(feature = "std")] {
422 } else if #[cfg(all(
425 any(
426 all(
427 target_os = "linux",
428 any(target_env = "gnu", target_env = "uclibc")
429 ),
430 target_os = "cygwin"
431 ),
432 feature = "rustc-dep-of-std"
433 ))] {
434 #[link(
435 name = "util",
436 kind = "static",
437 modifiers = "-bundle",
438 cfg(target_feature = "crt-static")
439 )]
440 #[link(
441 name = "rt",
442 kind = "static",
443 modifiers = "-bundle",
444 cfg(target_feature = "crt-static")
445 )]
446 #[link(
447 name = "pthread",
448 kind = "static",
449 modifiers = "-bundle",
450 cfg(target_feature = "crt-static")
451 )]
452 #[link(
453 name = "m",
454 kind = "static",
455 modifiers = "-bundle",
456 cfg(target_feature = "crt-static")
457 )]
458 #[link(
459 name = "dl",
460 kind = "static",
461 modifiers = "-bundle",
462 cfg(target_feature = "crt-static")
463 )]
464 #[link(
465 name = "c",
466 kind = "static",
467 modifiers = "-bundle",
468 cfg(target_feature = "crt-static")
469 )]
470 #[link(
471 name = "gcc_eh",
472 kind = "static",
473 modifiers = "-bundle",
474 cfg(target_feature = "crt-static")
475 )]
476 #[link(
477 name = "gcc",
478 kind = "static",
479 modifiers = "-bundle",
480 cfg(target_feature = "crt-static")
481 )]
482 #[link(
483 name = "c",
484 kind = "static",
485 modifiers = "-bundle",
486 cfg(target_feature = "crt-static")
487 )]
488 #[link(name = "util", cfg(not(target_feature = "crt-static")))]
489 #[link(name = "rt", cfg(not(target_feature = "crt-static")))]
490 #[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
491 #[link(name = "m", cfg(not(target_feature = "crt-static")))]
492 #[link(name = "dl", cfg(not(target_feature = "crt-static")))]
493 #[link(name = "c", cfg(not(target_feature = "crt-static")))]
494 extern "C" {}
495 } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
496 #[cfg_attr(
497 feature = "rustc-dep-of-std",
498 link(
499 name = "c",
500 kind = "static",
501 modifiers = "-bundle",
502 cfg(target_feature = "crt-static")
503 )
504 )]
505 #[cfg_attr(
506 feature = "rustc-dep-of-std",
507 link(name = "c", cfg(not(target_feature = "crt-static")))
508 )]
509 extern "C" {}
510 } else if #[cfg(target_os = "emscripten")] {
511 } else if #[cfg(all(target_os = "android", feature = "rustc-dep-of-std"))] {
514 #[link(
515 name = "c",
516 kind = "static",
517 modifiers = "-bundle",
518 cfg(target_feature = "crt-static")
519 )]
520 #[link(
521 name = "m",
522 kind = "static",
523 modifiers = "-bundle",
524 cfg(target_feature = "crt-static")
525 )]
526 #[link(name = "m", cfg(not(target_feature = "crt-static")))]
527 #[link(name = "c", cfg(not(target_feature = "crt-static")))]
528 extern "C" {}
529 } else if #[cfg(any(
530 target_os = "macos",
531 target_os = "ios",
532 target_os = "tvos",
533 target_os = "watchos",
534 target_os = "visionos",
535 target_os = "android",
536 target_os = "openbsd",
537 target_os = "nto",
538 ))] {
539 #[link(name = "c")]
540 #[link(name = "m")]
541 extern "C" {}
542 } else if #[cfg(target_os = "haiku")] {
543 #[link(name = "root")]
544 #[link(name = "network")]
545 extern "C" {}
546 } else if #[cfg(target_env = "newlib")] {
547 #[link(name = "c")]
548 #[link(name = "m")]
549 extern "C" {}
550 } else if #[cfg(target_env = "illumos")] {
551 #[link(name = "c")]
552 #[link(name = "m")]
553 extern "C" {}
554 } else if #[cfg(target_os = "redox")] {
555 #[cfg_attr(
556 feature = "rustc-dep-of-std",
557 link(
558 name = "c",
559 kind = "static",
560 modifiers = "-bundle",
561 cfg(target_feature = "crt-static")
562 )
563 )]
564 #[cfg_attr(
565 feature = "rustc-dep-of-std",
566 link(name = "c", cfg(not(target_feature = "crt-static")))
567 )]
568 extern "C" {}
569 } else if #[cfg(target_os = "aix")] {
570 #[link(name = "c")]
571 #[link(name = "m")]
572 #[link(name = "bsd")]
573 #[link(name = "pthread")]
574 extern "C" {}
575 } else {
576 #[link(name = "c")]
577 #[link(name = "m")]
578 #[link(name = "rt")]
579 #[link(name = "pthread")]
580 extern "C" {}
581 }
582}
583
584cfg_if! {
585 if #[cfg(not(all(target_os = "linux", target_env = "gnu")))] {
586 extern_ty! {
587 pub enum fpos_t {} }
589 }
590}
591
592extern_ty! {
593 pub enum FILE {}
594}
595
596extern "C" {
597 pub fn isalnum(c: c_int) -> c_int;
598 pub fn isalpha(c: c_int) -> c_int;
599 pub fn iscntrl(c: c_int) -> c_int;
600 pub fn isdigit(c: c_int) -> c_int;
601 pub fn isgraph(c: c_int) -> c_int;
602 pub fn islower(c: c_int) -> c_int;
603 pub fn isprint(c: c_int) -> c_int;
604 pub fn ispunct(c: c_int) -> c_int;
605 pub fn isspace(c: c_int) -> c_int;
606 pub fn isupper(c: c_int) -> c_int;
607 pub fn isxdigit(c: c_int) -> c_int;
608 pub fn isblank(c: c_int) -> c_int;
609 pub fn tolower(c: c_int) -> c_int;
610 pub fn toupper(c: c_int) -> c_int;
611 pub fn qsort(
612 base: *mut c_void,
613 num: size_t,
614 size: size_t,
615 compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
616 );
617 pub fn bsearch(
618 key: *const c_void,
619 base: *const c_void,
620 num: size_t,
621 size: size_t,
622 compar: Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
623 ) -> *mut c_void;
624 #[cfg_attr(
625 all(target_os = "macos", target_arch = "x86"),
626 link_name = "fopen$UNIX2003"
627 )]
628 #[cfg_attr(gnu_file_offset_bits64, link_name = "fopen64")]
629 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
630 #[cfg_attr(
631 all(target_os = "macos", target_arch = "x86"),
632 link_name = "freopen$UNIX2003"
633 )]
634 #[cfg_attr(gnu_file_offset_bits64, link_name = "freopen64")]
635 pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
636
637 pub fn fflush(file: *mut FILE) -> c_int;
638 pub fn fclose(file: *mut FILE) -> c_int;
639 pub fn remove(filename: *const c_char) -> c_int;
640 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
641 #[cfg_attr(gnu_file_offset_bits64, link_name = "tmpfile64")]
642 pub fn tmpfile() -> *mut FILE;
643 pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
644 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
645 pub fn getchar() -> c_int;
646 pub fn putchar(c: c_int) -> c_int;
647 pub fn fgetc(stream: *mut FILE) -> c_int;
648 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
649 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
650 #[cfg_attr(
651 all(target_os = "macos", target_arch = "x86"),
652 link_name = "fputs$UNIX2003"
653 )]
654 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
655 pub fn puts(s: *const c_char) -> c_int;
656 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
657 pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
658 #[cfg_attr(
659 all(target_os = "macos", target_arch = "x86"),
660 link_name = "fwrite$UNIX2003"
661 )]
662 pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
663 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
664 pub fn ftell(stream: *mut FILE) -> c_long;
665 pub fn rewind(stream: *mut FILE);
666 #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
667 #[cfg_attr(gnu_file_offset_bits64, link_name = "fgetpos64")]
668 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
669 #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
670 #[cfg_attr(gnu_file_offset_bits64, link_name = "fsetpos64")]
671 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
672 pub fn feof(stream: *mut FILE) -> c_int;
673 pub fn ferror(stream: *mut FILE) -> c_int;
674 pub fn clearerr(stream: *mut FILE);
675 pub fn perror(s: *const c_char);
676 pub fn atof(s: *const c_char) -> c_double;
677 pub fn atoi(s: *const c_char) -> c_int;
678 pub fn atol(s: *const c_char) -> c_long;
679 pub fn atoll(s: *const c_char) -> c_longlong;
680 #[cfg_attr(
681 all(target_os = "macos", target_arch = "x86"),
682 link_name = "strtod$UNIX2003"
683 )]
684 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
685 pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float;
686 pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
687 pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong;
688 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
689 pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong;
690 #[cfg_attr(target_os = "aix", link_name = "vec_calloc")]
691 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
692 #[cfg_attr(target_os = "aix", link_name = "vec_malloc")]
693 pub fn malloc(size: size_t) -> *mut c_void;
694 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
695 pub fn free(p: *mut c_void);
696 pub fn abort() -> !;
697 pub fn exit(status: c_int) -> !;
698 pub fn _exit(status: c_int) -> !;
699 #[cfg_attr(
700 all(target_os = "macos", target_arch = "x86"),
701 link_name = "system$UNIX2003"
702 )]
703 pub fn system(s: *const c_char) -> c_int;
704 pub fn getenv(s: *const c_char) -> *mut c_char;
705
706 pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
707 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
708 pub fn stpcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
709 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
710 pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
711 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
712 pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
713 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
714 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
715 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
716 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
717 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
718 pub fn strdup(cs: *const c_char) -> *mut c_char;
719 pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char;
720 pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
721 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
722 pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
723 pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
724 pub fn strlen(cs: *const c_char) -> size_t;
725 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
726 #[cfg_attr(
727 all(target_os = "macos", target_arch = "x86"),
728 link_name = "strerror$UNIX2003"
729 )]
730 pub fn strerror(n: c_int) -> *mut c_char;
731 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
732 pub fn strtok_r(s: *mut c_char, t: *const c_char, p: *mut *mut c_char) -> *mut c_char;
733 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
734 pub fn strsignal(sig: c_int) -> *mut c_char;
735 pub fn wcslen(buf: *const wchar_t) -> size_t;
736 pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> size_t;
737
738 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
739 pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t;
740 pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
741 pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
742 pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
743 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
744 pub fn memccpy(dest: *mut c_void, src: *const c_void, c: c_int, n: size_t) -> *mut c_void;
745}
746
747extern "C" {
748 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
749 pub fn getpwnam(name: *const c_char) -> *mut passwd;
750 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
751 pub fn getpwuid(uid: crate::uid_t) -> *mut passwd;
752
753 pub fn fprintf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
754 pub fn printf(format: *const c_char, ...) -> c_int;
755 pub fn snprintf(s: *mut c_char, n: size_t, format: *const c_char, ...) -> c_int;
756 pub fn sprintf(s: *mut c_char, format: *const c_char, ...) -> c_int;
757 #[cfg_attr(
758 all(target_os = "linux", not(target_env = "uclibc")),
759 link_name = "__isoc99_fscanf"
760 )]
761 pub fn fscanf(stream: *mut crate::FILE, format: *const c_char, ...) -> c_int;
762 #[cfg_attr(
763 all(target_os = "linux", not(target_env = "uclibc")),
764 link_name = "__isoc99_scanf"
765 )]
766 pub fn scanf(format: *const c_char, ...) -> c_int;
767 #[cfg_attr(
768 all(target_os = "linux", not(target_env = "uclibc")),
769 link_name = "__isoc99_sscanf"
770 )]
771 pub fn sscanf(s: *const c_char, format: *const c_char, ...) -> c_int;
772 pub fn getchar_unlocked() -> c_int;
773 pub fn putchar_unlocked(c: c_int) -> c_int;
774
775 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
776 #[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
777 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
778 #[cfg_attr(target_os = "solaris", link_name = "__xnet7_socket")]
779 #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
780 pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
781 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
782 #[cfg_attr(
783 all(target_os = "macos", target_arch = "x86"),
784 link_name = "connect$UNIX2003"
785 )]
786 #[cfg_attr(
787 any(target_os = "illumos", target_os = "solaris"),
788 link_name = "__xnet_connect"
789 )]
790 #[cfg_attr(target_os = "espidf", link_name = "lwip_connect")]
791 pub fn connect(socket: c_int, address: *const sockaddr, len: socklen_t) -> c_int;
792 #[cfg_attr(
793 all(target_os = "macos", target_arch = "x86"),
794 link_name = "listen$UNIX2003"
795 )]
796 #[cfg_attr(target_os = "espidf", link_name = "lwip_listen")]
797 pub fn listen(socket: c_int, backlog: c_int) -> c_int;
798 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
799 #[cfg_attr(
800 all(target_os = "macos", target_arch = "x86"),
801 link_name = "accept$UNIX2003"
802 )]
803 #[cfg_attr(target_os = "espidf", link_name = "lwip_accept")]
804 #[cfg_attr(target_os = "aix", link_name = "naccept")]
805 pub fn accept(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> c_int;
806 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
807 #[cfg_attr(
808 all(target_os = "macos", target_arch = "x86"),
809 link_name = "getpeername$UNIX2003"
810 )]
811 #[cfg_attr(target_os = "espidf", link_name = "lwip_getpeername")]
812 #[cfg_attr(target_os = "aix", link_name = "ngetpeername")]
813 pub fn getpeername(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t)
814 -> c_int;
815 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
816 #[cfg_attr(
817 all(target_os = "macos", target_arch = "x86"),
818 link_name = "getsockname$UNIX2003"
819 )]
820 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockname")]
821 #[cfg_attr(target_os = "aix", link_name = "ngetsockname")]
822 pub fn getsockname(socket: c_int, address: *mut sockaddr, address_len: *mut socklen_t)
823 -> c_int;
824 #[cfg_attr(target_os = "espidf", link_name = "lwip_setsockopt")]
825 #[cfg_attr(gnu_time_bits64, link_name = "__setsockopt64")]
826 pub fn setsockopt(
827 socket: c_int,
828 level: c_int,
829 name: c_int,
830 value: *const c_void,
831 option_len: socklen_t,
832 ) -> c_int;
833 #[cfg_attr(
834 all(target_os = "macos", target_arch = "x86"),
835 link_name = "socketpair$UNIX2003"
836 )]
837 #[cfg_attr(
838 any(target_os = "illumos", target_os = "solaris"),
839 link_name = "__xnet_socketpair"
840 )]
841 pub fn socketpair(
842 domain: c_int,
843 type_: c_int,
844 protocol: c_int,
845 socket_vector: *mut c_int,
846 ) -> c_int;
847 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
848 #[cfg_attr(
849 all(target_os = "macos", target_arch = "x86"),
850 link_name = "sendto$UNIX2003"
851 )]
852 #[cfg_attr(
853 any(target_os = "illumos", target_os = "solaris"),
854 link_name = "__xnet_sendto"
855 )]
856 #[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")]
857 pub fn sendto(
858 socket: c_int,
859 buf: *const c_void,
860 len: size_t,
861 flags: c_int,
862 addr: *const sockaddr,
863 addrlen: socklen_t,
864 ) -> ssize_t;
865 #[cfg_attr(target_os = "espidf", link_name = "lwip_shutdown")]
866 pub fn shutdown(socket: c_int, how: c_int) -> c_int;
867
868 #[cfg_attr(
869 all(target_os = "macos", target_arch = "x86"),
870 link_name = "chmod$UNIX2003"
871 )]
872 pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
873 #[cfg_attr(
874 all(target_os = "macos", target_arch = "x86"),
875 link_name = "fchmod$UNIX2003"
876 )]
877 pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
878
879 #[cfg_attr(
880 all(target_os = "macos", not(target_arch = "aarch64")),
881 link_name = "fstat$INODE64"
882 )]
883 #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
884 #[cfg_attr(
885 all(target_os = "freebsd", any(freebsd11, freebsd10)),
886 link_name = "fstat@FBSD_1.0"
887 )]
888 #[cfg_attr(gnu_time_bits64, link_name = "__fstat64_time64")]
889 #[cfg_attr(
890 all(not(gnu_time_bits64), gnu_file_offset_bits64),
891 link_name = "fstat64"
892 )]
893 #[cfg_attr(musl32_time64, link_name = "__fstat_time64")]
894 pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
895
896 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
897
898 #[cfg_attr(
899 all(target_os = "macos", not(target_arch = "aarch64")),
900 link_name = "stat$INODE64"
901 )]
902 #[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
903 #[cfg_attr(
904 all(target_os = "freebsd", any(freebsd11, freebsd10)),
905 link_name = "stat@FBSD_1.0"
906 )]
907 #[cfg_attr(gnu_time_bits64, link_name = "__stat64_time64")]
908 #[cfg_attr(
909 all(not(gnu_time_bits64), gnu_file_offset_bits64),
910 link_name = "stat64"
911 )]
912 #[cfg_attr(musl32_time64, link_name = "__stat_time64")]
913 pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
914
915 pub fn pclose(stream: *mut crate::FILE) -> c_int;
916 #[cfg_attr(
917 all(target_os = "macos", target_arch = "x86"),
918 link_name = "fdopen$UNIX2003"
919 )]
920 pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut crate::FILE;
921 pub fn fileno(stream: *mut crate::FILE) -> c_int;
922
923 #[cfg_attr(
924 all(target_os = "macos", target_arch = "x86"),
925 link_name = "open$UNIX2003"
926 )]
927 #[cfg_attr(gnu_file_offset_bits64, link_name = "open64")]
928 pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
929 #[cfg_attr(
930 all(target_os = "macos", target_arch = "x86"),
931 link_name = "creat$UNIX2003"
932 )]
933 #[cfg_attr(gnu_file_offset_bits64, link_name = "creat64")]
934 pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
935 #[cfg_attr(
936 all(target_os = "macos", target_arch = "x86"),
937 link_name = "fcntl$UNIX2003"
938 )]
939 #[cfg_attr(gnu_time_bits64, link_name = "__fcntl_time64")]
940 #[cfg_attr(
941 all(not(gnu_time_bits64), gnu_file_offset_bits64),
942 link_name = "__fcntl_time64"
943 )]
944 pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
945
946 #[cfg_attr(
947 all(target_os = "macos", target_arch = "x86_64"),
948 link_name = "opendir$INODE64"
949 )]
950 #[cfg_attr(
951 all(target_os = "macos", target_arch = "x86"),
952 link_name = "opendir$INODE64$UNIX2003"
953 )]
954 #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
955 pub fn opendir(dirname: *const c_char) -> *mut crate::DIR;
956
957 #[cfg_attr(
958 all(target_os = "macos", not(target_arch = "aarch64")),
959 link_name = "readdir$INODE64"
960 )]
961 #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
962 #[cfg_attr(
963 all(target_os = "freebsd", any(freebsd11, freebsd10)),
964 link_name = "readdir@FBSD_1.0"
965 )]
966 #[cfg_attr(gnu_file_offset_bits64, link_name = "readdir64")]
967 pub fn readdir(dirp: *mut crate::DIR) -> *mut crate::dirent;
968 #[cfg_attr(
969 all(target_os = "macos", target_arch = "x86"),
970 link_name = "closedir$UNIX2003"
971 )]
972 pub fn closedir(dirp: *mut crate::DIR) -> c_int;
973 #[cfg_attr(
974 all(target_os = "macos", target_arch = "x86_64"),
975 link_name = "rewinddir$INODE64"
976 )]
977 #[cfg_attr(
978 all(target_os = "macos", target_arch = "x86"),
979 link_name = "rewinddir$INODE64$UNIX2003"
980 )]
981 pub fn rewinddir(dirp: *mut crate::DIR);
982
983 pub fn fchmodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, flags: c_int) -> c_int;
984 pub fn fchown(fd: c_int, owner: crate::uid_t, group: crate::gid_t) -> c_int;
985 #[cfg(not(target_os = "l4re"))]
986 pub fn fchownat(
987 dirfd: c_int,
988 pathname: *const c_char,
989 owner: crate::uid_t,
990 group: crate::gid_t,
991 flags: c_int,
992 ) -> c_int;
993 #[cfg_attr(
994 all(target_os = "macos", not(target_arch = "aarch64")),
995 link_name = "fstatat$INODE64"
996 )]
997 #[cfg_attr(
998 all(target_os = "freebsd", any(freebsd11, freebsd10)),
999 link_name = "fstatat@FBSD_1.1"
1000 )]
1001 #[cfg_attr(gnu_time_bits64, link_name = "__fstatat64_time64")]
1002 #[cfg_attr(
1003 all(not(gnu_time_bits64), gnu_file_offset_bits64),
1004 link_name = "fstatat64"
1005 )]
1006 #[cfg(not(target_os = "l4re"))]
1007 #[cfg_attr(musl32_time64, link_name = "__fstatat_time64")]
1008 pub fn fstatat(dirfd: c_int, pathname: *const c_char, buf: *mut stat, flags: c_int) -> c_int;
1009 #[cfg(not(target_os = "l4re"))]
1010 pub fn linkat(
1011 olddirfd: c_int,
1012 oldpath: *const c_char,
1013 newdirfd: c_int,
1014 newpath: *const c_char,
1015 flags: c_int,
1016 ) -> c_int;
1017 #[cfg(not(target_os = "l4re"))]
1018 pub fn renameat(
1019 olddirfd: c_int,
1020 oldpath: *const c_char,
1021 newdirfd: c_int,
1022 newpath: *const c_char,
1023 ) -> c_int;
1024 #[cfg(not(target_os = "l4re"))]
1025 pub fn symlinkat(target: *const c_char, newdirfd: c_int, linkpath: *const c_char) -> c_int;
1026 #[cfg(not(target_os = "l4re"))]
1027 pub fn unlinkat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_int;
1028
1029 pub fn access(path: *const c_char, amode: c_int) -> c_int;
1030 pub fn alarm(seconds: c_uint) -> c_uint;
1031 pub fn chdir(dir: *const c_char) -> c_int;
1032 pub fn fchdir(dirfd: c_int) -> c_int;
1033 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int;
1034 #[cfg_attr(
1035 all(target_os = "macos", target_arch = "x86"),
1036 link_name = "lchown$UNIX2003"
1037 )]
1038 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> c_int;
1039 #[cfg_attr(
1040 all(target_os = "macos", target_arch = "x86"),
1041 link_name = "close$NOCANCEL$UNIX2003"
1042 )]
1043 #[cfg_attr(
1044 all(target_os = "macos", target_arch = "x86_64"),
1045 link_name = "close$NOCANCEL"
1046 )]
1047 pub fn close(fd: c_int) -> c_int;
1048 pub fn dup(fd: c_int) -> c_int;
1049 pub fn dup2(src: c_int, dst: c_int) -> c_int;
1050
1051 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> c_int;
1052 pub fn execle(path: *const c_char, arg0: *const c_char, ...) -> c_int;
1053 pub fn execlp(file: *const c_char, arg0: *const c_char, ...) -> c_int;
1054
1055 pub fn execv(prog: *const c_char, argv: *const *const c_char) -> c_int;
1057 pub fn execve(
1058 prog: *const c_char,
1059 argv: *const *const c_char,
1060 envp: *const *const c_char,
1061 ) -> c_int;
1062 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> c_int;
1063
1064 pub fn fork() -> pid_t;
1065 pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
1066 pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
1067 pub fn getegid() -> gid_t;
1068 pub fn geteuid() -> uid_t;
1069 pub fn getgid() -> gid_t;
1070 pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t) -> c_int;
1071 #[cfg_attr(target_os = "illumos", link_name = "getloginx")]
1072 pub fn getlogin() -> *mut c_char;
1073 #[cfg_attr(
1074 all(target_os = "macos", target_arch = "x86"),
1075 link_name = "getopt$UNIX2003"
1076 )]
1077 pub fn getopt(argc: c_int, argv: *const *mut c_char, optstr: *const c_char) -> c_int;
1078 pub fn getpgid(pid: pid_t) -> pid_t;
1079 pub fn getpgrp() -> pid_t;
1080 pub fn getpid() -> pid_t;
1081 pub fn getppid() -> pid_t;
1082 pub fn getuid() -> uid_t;
1083 pub fn isatty(fd: c_int) -> c_int;
1084 #[cfg_attr(target_os = "solaris", link_name = "__link_xpg4")]
1085 pub fn link(src: *const c_char, dst: *const c_char) -> c_int;
1086 #[cfg_attr(gnu_file_offset_bits64, link_name = "lseek64")]
1087 pub fn lseek(fd: c_int, offset: off_t, whence: c_int) -> off_t;
1088 pub fn pathconf(path: *const c_char, name: c_int) -> c_long;
1089 pub fn pipe(fds: *mut c_int) -> c_int;
1090 pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int;
1091 pub fn aligned_alloc(alignment: size_t, size: size_t) -> *mut c_void;
1092 #[cfg_attr(
1093 all(target_os = "macos", target_arch = "x86"),
1094 link_name = "read$UNIX2003"
1095 )]
1096 pub fn read(fd: c_int, buf: *mut c_void, count: size_t) -> ssize_t;
1097 pub fn rmdir(path: *const c_char) -> c_int;
1098 pub fn seteuid(uid: uid_t) -> c_int;
1099 pub fn setegid(gid: gid_t) -> c_int;
1100 pub fn setgid(gid: gid_t) -> c_int;
1101 pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
1102 pub fn setsid() -> pid_t;
1103 pub fn setuid(uid: uid_t) -> c_int;
1104 pub fn setreuid(ruid: uid_t, euid: uid_t) -> c_int;
1105 pub fn setregid(rgid: gid_t, egid: gid_t) -> c_int;
1106 #[cfg_attr(
1107 all(target_os = "macos", target_arch = "x86"),
1108 link_name = "sleep$UNIX2003"
1109 )]
1110 pub fn sleep(secs: c_uint) -> c_uint;
1111 #[cfg_attr(
1112 all(target_os = "macos", target_arch = "x86"),
1113 link_name = "nanosleep$UNIX2003"
1114 )]
1115 #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
1116 #[cfg_attr(gnu_time_bits64, link_name = "__nanosleep64")]
1117 #[cfg_attr(musl32_time64, link_name = "__nanosleep_time64")]
1118 pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> c_int;
1119 pub fn tcgetpgrp(fd: c_int) -> pid_t;
1120 pub fn tcsetpgrp(fd: c_int, pgrp: crate::pid_t) -> c_int;
1121 pub fn ttyname(fd: c_int) -> *mut c_char;
1122 #[cfg_attr(
1123 all(target_os = "macos", target_arch = "x86"),
1124 link_name = "ttyname_r$UNIX2003"
1125 )]
1126 #[cfg_attr(
1127 any(target_os = "illumos", target_os = "solaris"),
1128 link_name = "__posix_ttyname_r"
1129 )]
1130 pub fn ttyname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
1131 pub fn unlink(c: *const c_char) -> c_int;
1132 #[cfg_attr(
1133 all(target_os = "macos", target_arch = "x86"),
1134 link_name = "wait$UNIX2003"
1135 )]
1136 pub fn wait(status: *mut c_int) -> pid_t;
1137 #[cfg_attr(
1138 all(target_os = "macos", target_arch = "x86"),
1139 link_name = "waitpid$UNIX2003"
1140 )]
1141 pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) -> pid_t;
1142 #[cfg_attr(
1143 all(target_os = "macos", target_arch = "x86"),
1144 link_name = "write$UNIX2003"
1145 )]
1146 pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t;
1147 #[cfg_attr(
1148 all(target_os = "macos", target_arch = "x86"),
1149 link_name = "pread$UNIX2003"
1150 )]
1151 #[cfg_attr(gnu_file_offset_bits64, link_name = "pread64")]
1152 pub fn pread(fd: c_int, buf: *mut c_void, count: size_t, offset: off_t) -> ssize_t;
1153 #[cfg_attr(
1154 all(target_os = "macos", target_arch = "x86"),
1155 link_name = "pwrite$UNIX2003"
1156 )]
1157 #[cfg_attr(gnu_file_offset_bits64, link_name = "pwrite64")]
1158 pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t, offset: off_t) -> ssize_t;
1159 pub fn umask(mask: mode_t) -> mode_t;
1160
1161 #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
1162 #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__utime64")]
1163 pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
1164
1165 #[cfg_attr(
1166 all(target_os = "macos", target_arch = "x86"),
1167 link_name = "kill$UNIX2003"
1168 )]
1169 pub fn kill(pid: pid_t, sig: c_int) -> c_int;
1170 #[cfg_attr(
1171 all(target_os = "macos", target_arch = "x86"),
1172 link_name = "killpg$UNIX2003"
1173 )]
1174 pub fn killpg(pgrp: pid_t, sig: c_int) -> c_int;
1175
1176 pub fn mlock(addr: *const c_void, len: size_t) -> c_int;
1177 pub fn munlock(addr: *const c_void, len: size_t) -> c_int;
1178 pub fn mlockall(flags: c_int) -> c_int;
1179 pub fn munlockall() -> c_int;
1180
1181 #[cfg_attr(
1182 all(target_os = "macos", target_arch = "x86"),
1183 link_name = "mmap$UNIX2003"
1184 )]
1185 #[cfg_attr(gnu_file_offset_bits64, link_name = "mmap64")]
1186 pub fn mmap(
1187 addr: *mut c_void,
1188 len: size_t,
1189 prot: c_int,
1190 flags: c_int,
1191 fd: c_int,
1192 offset: off_t,
1193 ) -> *mut c_void;
1194 #[cfg_attr(
1195 all(target_os = "macos", target_arch = "x86"),
1196 link_name = "munmap$UNIX2003"
1197 )]
1198 pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
1199
1200 pub fn if_nametoindex(ifname: *const c_char) -> c_uint;
1201 pub fn if_indextoname(ifindex: c_uint, ifname: *mut c_char) -> *mut c_char;
1202
1203 #[cfg_attr(
1204 all(target_os = "macos", not(target_arch = "aarch64")),
1205 link_name = "lstat$INODE64"
1206 )]
1207 #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
1208 #[cfg_attr(
1209 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1210 link_name = "lstat@FBSD_1.0"
1211 )]
1212 #[cfg_attr(gnu_time_bits64, link_name = "__lstat64_time64")]
1213 #[cfg_attr(
1214 all(not(gnu_time_bits64), gnu_file_offset_bits64),
1215 link_name = "lstat64"
1216 )]
1217 #[cfg_attr(musl32_time64, link_name = "__lstat_time64")]
1218 pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
1219
1220 #[cfg_attr(
1221 all(target_os = "macos", target_arch = "x86"),
1222 link_name = "fsync$UNIX2003"
1223 )]
1224 pub fn fsync(fd: c_int) -> c_int;
1225
1226 #[cfg_attr(
1227 all(target_os = "macos", target_arch = "x86"),
1228 link_name = "setenv$UNIX2003"
1229 )]
1230 pub fn setenv(name: *const c_char, val: *const c_char, overwrite: c_int) -> c_int;
1231 #[cfg_attr(
1232 all(target_os = "macos", target_arch = "x86"),
1233 link_name = "unsetenv$UNIX2003"
1234 )]
1235 #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
1236 pub fn unsetenv(name: *const c_char) -> c_int;
1237
1238 pub fn symlink(path1: *const c_char, path2: *const c_char) -> c_int;
1239
1240 #[cfg_attr(gnu_file_offset_bits64, link_name = "truncate64")]
1241 pub fn truncate(path: *const c_char, length: off_t) -> c_int;
1242 #[cfg_attr(gnu_file_offset_bits64, link_name = "ftruncate64")]
1243 pub fn ftruncate(fd: c_int, length: off_t) -> c_int;
1244
1245 pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t;
1246
1247 #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
1248 #[cfg_attr(gnu_time_bits64, link_name = "__getrusage64")]
1249 #[cfg_attr(musl32_time64, link_name = "__getrusage_time64")]
1250 pub fn getrusage(resource: c_int, usage: *mut rusage) -> c_int;
1251
1252 #[cfg_attr(
1253 any(
1254 target_os = "macos",
1255 target_os = "ios",
1256 target_os = "tvos",
1257 target_os = "watchos",
1258 target_os = "visionos"
1259 ),
1260 link_name = "realpath$DARWIN_EXTSN"
1261 )]
1262 pub fn realpath(pathname: *const c_char, resolved: *mut c_char) -> *mut c_char;
1263
1264 #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
1265 pub fn times(buf: *mut crate::tms) -> crate::clock_t;
1266
1267 pub fn pthread_self() -> crate::pthread_t;
1268 pub fn pthread_equal(t1: crate::pthread_t, t2: crate::pthread_t) -> c_int;
1269 #[cfg_attr(
1270 all(target_os = "macos", target_arch = "x86"),
1271 link_name = "pthread_join$UNIX2003"
1272 )]
1273 pub fn pthread_join(native: crate::pthread_t, value: *mut *mut c_void) -> c_int;
1274 pub fn pthread_exit(value: *mut c_void) -> !;
1275 pub fn pthread_attr_init(attr: *mut crate::pthread_attr_t) -> c_int;
1276 pub fn pthread_attr_destroy(attr: *mut crate::pthread_attr_t) -> c_int;
1277 pub fn pthread_attr_getstacksize(
1278 attr: *const crate::pthread_attr_t,
1279 stacksize: *mut size_t,
1280 ) -> c_int;
1281 pub fn pthread_attr_setstacksize(attr: *mut crate::pthread_attr_t, stack_size: size_t)
1282 -> c_int;
1283 pub fn pthread_attr_setdetachstate(attr: *mut crate::pthread_attr_t, state: c_int) -> c_int;
1284 pub fn pthread_detach(thread: crate::pthread_t) -> c_int;
1285 #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
1286 pub fn sched_yield() -> c_int;
1287 pub fn pthread_key_create(
1288 key: *mut crate::pthread_key_t,
1289 dtor: Option<unsafe extern "C" fn(*mut c_void)>,
1290 ) -> c_int;
1291 pub fn pthread_key_delete(key: crate::pthread_key_t) -> c_int;
1292 pub fn pthread_getspecific(key: crate::pthread_key_t) -> *mut c_void;
1293 pub fn pthread_setspecific(key: crate::pthread_key_t, value: *const c_void) -> c_int;
1294 pub fn pthread_mutex_init(
1295 lock: *mut crate::pthread_mutex_t,
1296 attr: *const crate::pthread_mutexattr_t,
1297 ) -> c_int;
1298 pub fn pthread_mutex_destroy(lock: *mut crate::pthread_mutex_t) -> c_int;
1299 pub fn pthread_mutex_lock(lock: *mut crate::pthread_mutex_t) -> c_int;
1300 pub fn pthread_mutex_trylock(lock: *mut crate::pthread_mutex_t) -> c_int;
1301 pub fn pthread_mutex_unlock(lock: *mut crate::pthread_mutex_t) -> c_int;
1302
1303 pub fn pthread_mutexattr_init(attr: *mut crate::pthread_mutexattr_t) -> c_int;
1304 #[cfg_attr(
1305 all(target_os = "macos", target_arch = "x86"),
1306 link_name = "pthread_mutexattr_destroy$UNIX2003"
1307 )]
1308 pub fn pthread_mutexattr_destroy(attr: *mut crate::pthread_mutexattr_t) -> c_int;
1309 pub fn pthread_mutexattr_settype(attr: *mut crate::pthread_mutexattr_t, _type: c_int) -> c_int;
1310
1311 #[cfg_attr(
1312 all(target_os = "macos", target_arch = "x86"),
1313 link_name = "pthread_cond_init$UNIX2003"
1314 )]
1315 pub fn pthread_cond_init(
1316 cond: *mut crate::pthread_cond_t,
1317 attr: *const crate::pthread_condattr_t,
1318 ) -> c_int;
1319 #[cfg_attr(
1320 all(target_os = "macos", target_arch = "x86"),
1321 link_name = "pthread_cond_wait$UNIX2003"
1322 )]
1323 pub fn pthread_cond_wait(
1324 cond: *mut crate::pthread_cond_t,
1325 lock: *mut crate::pthread_mutex_t,
1326 ) -> c_int;
1327 #[cfg_attr(
1328 all(target_os = "macos", target_arch = "x86"),
1329 link_name = "pthread_cond_timedwait$UNIX2003"
1330 )]
1331 #[cfg_attr(gnu_time_bits64, link_name = "__pthread_cond_timedwait64")]
1332 #[cfg_attr(musl32_time64, link_name = "__pthread_cond_timedwait_time64")]
1333 pub fn pthread_cond_timedwait(
1334 cond: *mut crate::pthread_cond_t,
1335 lock: *mut crate::pthread_mutex_t,
1336 abstime: *const crate::timespec,
1337 ) -> c_int;
1338 pub fn pthread_cond_signal(cond: *mut crate::pthread_cond_t) -> c_int;
1339 pub fn pthread_cond_broadcast(cond: *mut crate::pthread_cond_t) -> c_int;
1340 pub fn pthread_cond_destroy(cond: *mut crate::pthread_cond_t) -> c_int;
1341 pub fn pthread_condattr_init(attr: *mut crate::pthread_condattr_t) -> c_int;
1342 pub fn pthread_condattr_destroy(attr: *mut crate::pthread_condattr_t) -> c_int;
1343 #[cfg_attr(
1344 all(target_os = "macos", target_arch = "x86"),
1345 link_name = "pthread_rwlock_init$UNIX2003"
1346 )]
1347 pub fn pthread_rwlock_init(
1348 lock: *mut crate::pthread_rwlock_t,
1349 attr: *const crate::pthread_rwlockattr_t,
1350 ) -> c_int;
1351 #[cfg_attr(
1352 all(target_os = "macos", target_arch = "x86"),
1353 link_name = "pthread_rwlock_destroy$UNIX2003"
1354 )]
1355 pub fn pthread_rwlock_destroy(lock: *mut crate::pthread_rwlock_t) -> c_int;
1356 #[cfg_attr(
1357 all(target_os = "macos", target_arch = "x86"),
1358 link_name = "pthread_rwlock_rdlock$UNIX2003"
1359 )]
1360 pub fn pthread_rwlock_rdlock(lock: *mut crate::pthread_rwlock_t) -> c_int;
1361 #[cfg_attr(
1362 all(target_os = "macos", target_arch = "x86"),
1363 link_name = "pthread_rwlock_tryrdlock$UNIX2003"
1364 )]
1365 pub fn pthread_rwlock_tryrdlock(lock: *mut crate::pthread_rwlock_t) -> c_int;
1366 #[cfg_attr(
1367 all(target_os = "macos", target_arch = "x86"),
1368 link_name = "pthread_rwlock_wrlock$UNIX2003"
1369 )]
1370 pub fn pthread_rwlock_wrlock(lock: *mut crate::pthread_rwlock_t) -> c_int;
1371 #[cfg_attr(
1372 all(target_os = "macos", target_arch = "x86"),
1373 link_name = "pthread_rwlock_trywrlock$UNIX2003"
1374 )]
1375 pub fn pthread_rwlock_trywrlock(lock: *mut crate::pthread_rwlock_t) -> c_int;
1376 #[cfg_attr(
1377 all(target_os = "macos", target_arch = "x86"),
1378 link_name = "pthread_rwlock_unlock$UNIX2003"
1379 )]
1380 pub fn pthread_rwlock_unlock(lock: *mut crate::pthread_rwlock_t) -> c_int;
1381 pub fn pthread_rwlockattr_init(attr: *mut crate::pthread_rwlockattr_t) -> c_int;
1382 pub fn pthread_rwlockattr_destroy(attr: *mut crate::pthread_rwlockattr_t) -> c_int;
1383
1384 #[cfg_attr(
1385 any(target_os = "illumos", target_os = "solaris"),
1386 link_name = "__xnet_getsockopt"
1387 )]
1388 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")]
1389 #[cfg_attr(gnu_time_bits64, link_name = "__getsockopt64")]
1390 pub fn getsockopt(
1391 sockfd: c_int,
1392 level: c_int,
1393 optname: c_int,
1394 optval: *mut c_void,
1395 optlen: *mut crate::socklen_t,
1396 ) -> c_int;
1397 pub fn raise(signum: c_int) -> c_int;
1398
1399 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
1400 #[cfg_attr(gnu_time_bits64, link_name = "__utimes64")]
1401 #[cfg_attr(musl32_time64, link_name = "__utimes_time64")]
1402 pub fn utimes(filename: *const c_char, times: *const crate::timeval) -> c_int;
1403 pub fn dlopen(filename: *const c_char, flag: c_int) -> *mut c_void;
1404 pub fn dlerror() -> *mut c_char;
1405 #[cfg_attr(musl32_time64, link_name = "__dlsym_time64")]
1406 pub fn dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void;
1407 pub fn dlclose(handle: *mut c_void) -> c_int;
1408
1409 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
1410 #[cfg_attr(
1411 any(target_os = "illumos", target_os = "solaris"),
1412 link_name = "__xnet_getaddrinfo"
1413 )]
1414 #[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")]
1415 pub fn getaddrinfo(
1416 node: *const c_char,
1417 service: *const c_char,
1418 hints: *const addrinfo,
1419 res: *mut *mut addrinfo,
1420 ) -> c_int;
1421 #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))]
1422 #[cfg_attr(target_os = "espidf", link_name = "lwip_freeaddrinfo")]
1423 pub fn freeaddrinfo(res: *mut addrinfo);
1424 pub fn hstrerror(errcode: c_int) -> *const c_char;
1425 pub fn gai_strerror(errcode: c_int) -> *const c_char;
1426 #[cfg_attr(
1427 any(
1428 all(
1429 target_os = "linux",
1430 not(any(target_env = "musl", target_env = "ohos"))
1431 ),
1432 target_os = "freebsd",
1433 target_os = "cygwin",
1434 target_os = "dragonfly",
1435 target_os = "haiku"
1436 ),
1437 link_name = "__res_init"
1438 )]
1439 #[cfg_attr(
1440 any(
1441 target_os = "macos",
1442 target_os = "ios",
1443 target_os = "tvos",
1444 target_os = "watchos",
1445 target_os = "visionos"
1446 ),
1447 link_name = "res_9_init"
1448 )]
1449 #[cfg_attr(target_os = "aix", link_name = "_res_init")]
1450 #[cfg(not(target_os = "l4re"))]
1451 pub fn res_init() -> c_int;
1452
1453 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
1454 #[cfg_attr(gnu_time_bits64, link_name = "__gmtime64_r")]
1455 #[cfg_attr(not(musl32_time64), allow(deprecated))]
1456 #[cfg_attr(musl32_time64, link_name = "__gmtime64_r")]
1457 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1458 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
1459 #[cfg_attr(gnu_time_bits64, link_name = "__localtime64_r")]
1460 #[cfg_attr(not(musl32_time64), allow(deprecated))]
1461 #[cfg_attr(musl32_time64, link_name = "__localtime64_r")]
1462 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1463 #[cfg_attr(
1464 all(target_os = "macos", target_arch = "x86"),
1465 link_name = "mktime$UNIX2003"
1466 )]
1467 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
1468 #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__mktime64")]
1469 #[cfg_attr(not(musl32_time64), allow(deprecated))]
1470 pub fn mktime(tm: *mut tm) -> time_t;
1471 #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
1472 #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__time64")]
1473 #[cfg_attr(not(musl32_time64), allow(deprecated))]
1474 pub fn time(time: *mut time_t) -> time_t;
1475 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
1476 #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__gmtime64")]
1477 #[cfg_attr(not(musl32_time64), allow(deprecated))]
1478 pub fn gmtime(time_p: *const time_t) -> *mut tm;
1479 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
1480 #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__localtime64")]
1481 #[cfg_attr(not(musl32_time64), allow(deprecated))]
1482 pub fn localtime(time_p: *const time_t) -> *mut tm;
1483 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
1484 #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__difftime64")]
1485 #[cfg_attr(not(musl32_time64), allow(deprecated))]
1486 pub fn difftime(time1: time_t, time0: time_t) -> c_double;
1487 #[cfg(not(target_os = "aix"))]
1488 #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
1489 #[cfg_attr(gnu_time_bits64, link_name = "__timegm64")]
1490 #[cfg_attr(not(musl32_time64), allow(deprecated))]
1491 #[cfg_attr(musl32_time64, link_name = "__timegm_time64")]
1492 pub fn timegm(tm: *mut crate::tm) -> time_t;
1493
1494 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
1495 #[cfg_attr(
1496 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1497 link_name = "mknod@FBSD_1.0"
1498 )]
1499 pub fn mknod(pathname: *const c_char, mode: mode_t, dev: crate::dev_t) -> c_int;
1500 #[cfg(not(target_os = "espidf"))]
1501 pub fn gethostname(name: *mut c_char, len: size_t) -> c_int;
1502 pub fn endservent();
1503 pub fn getservbyname(name: *const c_char, proto: *const c_char) -> *mut servent;
1504 pub fn getservbyport(port: c_int, proto: *const c_char) -> *mut servent;
1505 pub fn getservent() -> *mut servent;
1506 pub fn setservent(stayopen: c_int);
1507 pub fn getprotobyname(name: *const c_char) -> *mut protoent;
1508 pub fn getprotobynumber(proto: c_int) -> *mut protoent;
1509 pub fn chroot(name: *const c_char) -> c_int;
1510 #[cfg(target_os = "cygwin")]
1511 pub fn usleep(secs: useconds_t) -> c_int;
1512 #[cfg_attr(
1513 all(target_os = "macos", target_arch = "x86"),
1514 link_name = "usleep$UNIX2003"
1515 )]
1516 #[cfg(not(target_os = "cygwin"))]
1517 pub fn usleep(secs: c_uint) -> c_int;
1518 #[cfg_attr(
1519 all(target_os = "macos", target_arch = "x86"),
1520 link_name = "send$UNIX2003"
1521 )]
1522 #[cfg_attr(target_os = "espidf", link_name = "lwip_send")]
1523 pub fn send(socket: c_int, buf: *const c_void, len: size_t, flags: c_int) -> ssize_t;
1524 #[cfg_attr(
1525 all(target_os = "macos", target_arch = "x86"),
1526 link_name = "recv$UNIX2003"
1527 )]
1528 #[cfg_attr(target_os = "espidf", link_name = "lwip_recv")]
1529 pub fn recv(socket: c_int, buf: *mut c_void, len: size_t, flags: c_int) -> ssize_t;
1530 #[cfg_attr(
1531 all(target_os = "macos", target_arch = "x86"),
1532 link_name = "putenv$UNIX2003"
1533 )]
1534 #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
1535 pub fn putenv(string: *mut c_char) -> c_int;
1536 #[cfg_attr(
1537 all(target_os = "macos", target_arch = "x86"),
1538 link_name = "poll$UNIX2003"
1539 )]
1540 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int;
1541 #[cfg_attr(
1542 all(target_os = "macos", target_arch = "x86_64"),
1543 link_name = "select$1050"
1544 )]
1545 #[cfg_attr(
1546 all(target_os = "macos", target_arch = "x86"),
1547 link_name = "select$UNIX2003"
1548 )]
1549 #[cfg_attr(target_os = "netbsd", link_name = "__select50")]
1550 #[cfg_attr(target_os = "aix", link_name = "__fd_select")]
1551 #[cfg_attr(gnu_time_bits64, link_name = "__select64")]
1552 #[cfg_attr(musl32_time64, link_name = "__select_time64")]
1553 pub fn select(
1554 nfds: c_int,
1555 readfds: *mut fd_set,
1556 writefds: *mut fd_set,
1557 errorfds: *mut fd_set,
1558 timeout: *mut timeval,
1559 ) -> c_int;
1560 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
1561 pub fn setlocale(category: c_int, locale: *const c_char) -> *mut c_char;
1562 pub fn localeconv() -> *mut lconv;
1563
1564 #[cfg_attr(
1565 all(target_os = "macos", target_arch = "x86"),
1566 link_name = "sem_wait$UNIX2003"
1567 )]
1568 pub fn sem_wait(sem: *mut sem_t) -> c_int;
1569 pub fn sem_trywait(sem: *mut sem_t) -> c_int;
1570 pub fn sem_post(sem: *mut sem_t) -> c_int;
1571 #[cfg_attr(gnu_file_offset_bits64, link_name = "statvfs64")]
1572 pub fn statvfs(path: *const c_char, buf: *mut crate::statvfs) -> c_int;
1573 #[cfg_attr(gnu_file_offset_bits64, link_name = "fstatvfs64")]
1574 pub fn fstatvfs(fd: c_int, buf: *mut crate::statvfs) -> c_int;
1575
1576 #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
1577 pub fn sigemptyset(set: *mut sigset_t) -> c_int;
1578 #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
1579 pub fn sigaddset(set: *mut sigset_t, signum: c_int) -> c_int;
1580 #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
1581 pub fn sigfillset(set: *mut sigset_t) -> c_int;
1582 #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
1583 pub fn sigdelset(set: *mut sigset_t, signum: c_int) -> c_int;
1584 #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
1585 pub fn sigismember(set: *const sigset_t, signum: c_int) -> c_int;
1586
1587 #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
1588 pub fn sigprocmask(how: c_int, set: *const sigset_t, oldset: *mut sigset_t) -> c_int;
1589 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
1590 pub fn sigpending(set: *mut sigset_t) -> c_int;
1591
1592 #[cfg_attr(target_os = "solaris", link_name = "__sysconf_xpg7")]
1593 pub fn sysconf(name: c_int) -> c_long;
1594
1595 pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
1596
1597 #[cfg_attr(gnu_file_offset_bits64, link_name = "fseeko64")]
1598 pub fn fseeko(stream: *mut crate::FILE, offset: off_t, whence: c_int) -> c_int;
1599 #[cfg_attr(gnu_file_offset_bits64, link_name = "ftello64")]
1600 pub fn ftello(stream: *mut crate::FILE) -> off_t;
1601 #[cfg_attr(
1602 all(target_os = "macos", target_arch = "x86"),
1603 link_name = "tcdrain$UNIX2003"
1604 )]
1605 pub fn tcdrain(fd: c_int) -> c_int;
1606 #[cfg_attr(
1607 all(target_os = "linux", target_env = "gnu", target_arch = "arm"),
1608 link_name = "cfgetispeed@GLIBC_2.4"
1609 )]
1610 #[cfg_attr(
1611 all(target_os = "linux", target_env = "gnu", target_arch = "csky"),
1612 link_name = "cfgetispeed@GLIBC_2.29"
1613 )]
1614 #[cfg_attr(
1615 all(target_os = "linux", target_env = "gnu", target_arch = "m68k"),
1616 link_name = "cfgetispeed@GLIBC_2.0"
1617 )]
1618 #[cfg_attr(
1619 all(
1620 target_os = "linux",
1621 target_env = "gnu",
1622 any(target_arch = "mips", target_arch = "mips32r6")
1623 ),
1624 link_name = "cfgetispeed@GLIBC_2.0"
1625 )]
1626 #[cfg_attr(
1627 all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"),
1628 link_name = "cfgetispeed@GLIBC_2.0"
1629 )]
1630 #[cfg_attr(
1631 all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"),
1632 link_name = "cfgetispeed@GLIBC_2.33"
1633 )]
1634 #[cfg_attr(
1635 all(target_os = "linux", target_env = "gnu", target_arch = "sparc"),
1636 link_name = "cfgetispeed@GLIBC_2.0"
1637 )]
1638 #[cfg_attr(
1639 all(target_os = "linux", target_env = "gnu", target_arch = "x86"),
1640 link_name = "cfgetispeed@GLIBC_2.0"
1641 )]
1642 #[cfg_attr(
1643 all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"),
1644 link_name = "cfgetispeed@GLIBC_2.17"
1645 )]
1646 #[cfg_attr(
1647 all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"),
1648 link_name = "cfgetispeed@GLIBC_2.36"
1649 )]
1650 #[cfg_attr(
1651 all(
1652 target_os = "linux",
1653 target_env = "gnu",
1654 any(target_arch = "mips64", target_arch = "mips64r6")
1655 ),
1656 link_name = "cfgetispeed@GLIBC_2.0"
1657 )]
1658 #[cfg_attr(
1659 all(
1660 target_os = "linux",
1661 target_env = "gnu",
1662 target_arch = "powerpc64",
1663 target_endian = "big"
1664 ),
1665 link_name = "cfgetispeed@GLIBC_2.3"
1666 )]
1667 #[cfg_attr(
1668 all(
1669 target_os = "linux",
1670 target_env = "gnu",
1671 target_arch = "powerpc64",
1672 target_endian = "little"
1673 ),
1674 link_name = "cfgetispeed@GLIBC_2.17"
1675 )]
1676 #[cfg_attr(
1677 all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"),
1678 link_name = "cfgetispeed@GLIBC_2.27"
1679 )]
1680 #[cfg_attr(
1681 all(target_os = "linux", target_env = "gnu", target_arch = "s390x"),
1682 link_name = "cfgetispeed@GLIBC_2.2"
1683 )]
1684 #[cfg_attr(
1685 all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"),
1686 link_name = "cfgetispeed@GLIBC_2.2"
1687 )]
1688 #[cfg_attr(
1689 all(
1690 target_os = "linux",
1691 target_env = "gnu",
1692 target_arch = "x86_64",
1693 target_pointer_width = "64"
1694 ),
1695 link_name = "cfgetispeed@GLIBC_2.2.5"
1696 )]
1697 #[cfg_attr(
1698 all(
1699 target_os = "linux",
1700 target_env = "gnu",
1701 target_arch = "x86_64",
1702 target_pointer_width = "32"
1703 ),
1704 link_name = "cfgetispeed@GLIBC_2.16"
1705 )]
1706 pub fn cfgetispeed(termios: *const crate::termios) -> crate::speed_t;
1707 #[cfg_attr(
1708 all(target_os = "linux", target_env = "gnu", target_arch = "arm"),
1709 link_name = "cfgetospeed@GLIBC_2.4"
1710 )]
1711 #[cfg_attr(
1712 all(target_os = "linux", target_env = "gnu", target_arch = "csky"),
1713 link_name = "cfgetospeed@GLIBC_2.29"
1714 )]
1715 #[cfg_attr(
1716 all(target_os = "linux", target_env = "gnu", target_arch = "m68k"),
1717 link_name = "cfgetospeed@GLIBC_2.0"
1718 )]
1719 #[cfg_attr(
1720 all(
1721 target_os = "linux",
1722 target_env = "gnu",
1723 any(target_arch = "mips", target_arch = "mips32r6")
1724 ),
1725 link_name = "cfgetospeed@GLIBC_2.0"
1726 )]
1727 #[cfg_attr(
1728 all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"),
1729 link_name = "cfgetospeed@GLIBC_2.0"
1730 )]
1731 #[cfg_attr(
1732 all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"),
1733 link_name = "cfgetospeed@GLIBC_2.33"
1734 )]
1735 #[cfg_attr(
1736 all(target_os = "linux", target_env = "gnu", target_arch = "sparc"),
1737 link_name = "cfgetospeed@GLIBC_2.0"
1738 )]
1739 #[cfg_attr(
1740 all(target_os = "linux", target_env = "gnu", target_arch = "x86"),
1741 link_name = "cfgetospeed@GLIBC_2.0"
1742 )]
1743 #[cfg_attr(
1744 all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"),
1745 link_name = "cfgetospeed@GLIBC_2.17"
1746 )]
1747 #[cfg_attr(
1748 all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"),
1749 link_name = "cfgetospeed@GLIBC_2.36"
1750 )]
1751 #[cfg_attr(
1752 all(
1753 target_os = "linux",
1754 target_env = "gnu",
1755 any(target_arch = "mips64", target_arch = "mips64r6")
1756 ),
1757 link_name = "cfgetospeed@GLIBC_2.0"
1758 )]
1759 #[cfg_attr(
1760 all(
1761 target_os = "linux",
1762 target_env = "gnu",
1763 target_arch = "powerpc64",
1764 target_endian = "big"
1765 ),
1766 link_name = "cfgetospeed@GLIBC_2.3"
1767 )]
1768 #[cfg_attr(
1769 all(
1770 target_os = "linux",
1771 target_env = "gnu",
1772 target_arch = "powerpc64",
1773 target_endian = "little"
1774 ),
1775 link_name = "cfgetospeed@GLIBC_2.17"
1776 )]
1777 #[cfg_attr(
1778 all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"),
1779 link_name = "cfgetospeed@GLIBC_2.27"
1780 )]
1781 #[cfg_attr(
1782 all(target_os = "linux", target_env = "gnu", target_arch = "s390x"),
1783 link_name = "cfgetospeed@GLIBC_2.2"
1784 )]
1785 #[cfg_attr(
1786 all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"),
1787 link_name = "cfgetospeed@GLIBC_2.2"
1788 )]
1789 #[cfg_attr(
1790 all(
1791 target_os = "linux",
1792 target_env = "gnu",
1793 target_arch = "x86_64",
1794 target_pointer_width = "64"
1795 ),
1796 link_name = "cfgetospeed@GLIBC_2.2.5"
1797 )]
1798 #[cfg_attr(
1799 all(
1800 target_os = "linux",
1801 target_env = "gnu",
1802 target_arch = "x86_64",
1803 target_pointer_width = "32"
1804 ),
1805 link_name = "cfgetospeed@GLIBC_2.16"
1806 )]
1807 pub fn cfgetospeed(termios: *const crate::termios) -> crate::speed_t;
1808 #[cfg_attr(
1809 all(target_os = "linux", target_env = "gnu", target_arch = "arm"),
1810 link_name = "cfsetispeed@GLIBC_2.4"
1811 )]
1812 #[cfg_attr(
1813 all(target_os = "linux", target_env = "gnu", target_arch = "csky"),
1814 link_name = "cfsetispeed@GLIBC_2.29"
1815 )]
1816 #[cfg_attr(
1817 all(target_os = "linux", target_env = "gnu", target_arch = "m68k"),
1818 link_name = "cfsetispeed@GLIBC_2.0"
1819 )]
1820 #[cfg_attr(
1821 all(
1822 target_os = "linux",
1823 target_env = "gnu",
1824 any(target_arch = "mips", target_arch = "mips32r6")
1825 ),
1826 link_name = "cfsetispeed@GLIBC_2.0"
1827 )]
1828 #[cfg_attr(
1829 all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"),
1830 link_name = "cfsetispeed@GLIBC_2.0"
1831 )]
1832 #[cfg_attr(
1833 all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"),
1834 link_name = "cfsetispeed@GLIBC_2.33"
1835 )]
1836 #[cfg_attr(
1837 all(target_os = "linux", target_env = "gnu", target_arch = "sparc"),
1838 link_name = "cfsetispeed@GLIBC_2.0"
1839 )]
1840 #[cfg_attr(
1841 all(target_os = "linux", target_env = "gnu", target_arch = "x86"),
1842 link_name = "cfsetispeed@GLIBC_2.0"
1843 )]
1844 #[cfg_attr(
1845 all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"),
1846 link_name = "cfsetispeed@GLIBC_2.17"
1847 )]
1848 #[cfg_attr(
1849 all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"),
1850 link_name = "cfsetispeed@GLIBC_2.36"
1851 )]
1852 #[cfg_attr(
1853 all(
1854 target_os = "linux",
1855 target_env = "gnu",
1856 any(target_arch = "mips64", target_arch = "mips64r6")
1857 ),
1858 link_name = "cfsetispeed@GLIBC_2.0"
1859 )]
1860 #[cfg_attr(
1861 all(
1862 target_os = "linux",
1863 target_env = "gnu",
1864 target_arch = "powerpc64",
1865 target_endian = "big"
1866 ),
1867 link_name = "cfsetispeed@GLIBC_2.3"
1868 )]
1869 #[cfg_attr(
1870 all(
1871 target_os = "linux",
1872 target_env = "gnu",
1873 target_arch = "powerpc64",
1874 target_endian = "little"
1875 ),
1876 link_name = "cfsetispeed@GLIBC_2.17"
1877 )]
1878 #[cfg_attr(
1879 all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"),
1880 link_name = "cfsetispeed@GLIBC_2.27"
1881 )]
1882 #[cfg_attr(
1883 all(target_os = "linux", target_env = "gnu", target_arch = "s390x"),
1884 link_name = "cfsetispeed@GLIBC_2.2"
1885 )]
1886 #[cfg_attr(
1887 all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"),
1888 link_name = "cfsetispeed@GLIBC_2.2"
1889 )]
1890 #[cfg_attr(
1891 all(
1892 target_os = "linux",
1893 target_env = "gnu",
1894 target_arch = "x86_64",
1895 target_pointer_width = "64"
1896 ),
1897 link_name = "cfsetispeed@GLIBC_2.2.5"
1898 )]
1899 #[cfg_attr(
1900 all(
1901 target_os = "linux",
1902 target_env = "gnu",
1903 target_arch = "x86_64",
1904 target_pointer_width = "32"
1905 ),
1906 link_name = "cfsetispeed@GLIBC_2.16"
1907 )]
1908 pub fn cfsetispeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
1909 #[cfg_attr(
1910 all(target_os = "linux", target_env = "gnu", target_arch = "arm"),
1911 link_name = "cfsetospeed@GLIBC_2.4"
1912 )]
1913 #[cfg_attr(
1914 all(target_os = "linux", target_env = "gnu", target_arch = "csky"),
1915 link_name = "cfsetospeed@GLIBC_2.29"
1916 )]
1917 #[cfg_attr(
1918 all(target_os = "linux", target_env = "gnu", target_arch = "m68k"),
1919 link_name = "cfsetospeed@GLIBC_2.0"
1920 )]
1921 #[cfg_attr(
1922 all(
1923 target_os = "linux",
1924 target_env = "gnu",
1925 any(target_arch = "mips", target_arch = "mips32r6")
1926 ),
1927 link_name = "cfsetospeed@GLIBC_2.0"
1928 )]
1929 #[cfg_attr(
1930 all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"),
1931 link_name = "cfsetospeed@GLIBC_2.0"
1932 )]
1933 #[cfg_attr(
1934 all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"),
1935 link_name = "cfsetospeed@GLIBC_2.33"
1936 )]
1937 #[cfg_attr(
1938 all(target_os = "linux", target_env = "gnu", target_arch = "sparc"),
1939 link_name = "cfsetospeed@GLIBC_2.0"
1940 )]
1941 #[cfg_attr(
1942 all(target_os = "linux", target_env = "gnu", target_arch = "x86"),
1943 link_name = "cfsetospeed@GLIBC_2.0"
1944 )]
1945 #[cfg_attr(
1946 all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"),
1947 link_name = "cfsetospeed@GLIBC_2.17"
1948 )]
1949 #[cfg_attr(
1950 all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"),
1951 link_name = "cfsetospeed@GLIBC_2.36"
1952 )]
1953 #[cfg_attr(
1954 all(
1955 target_os = "linux",
1956 target_env = "gnu",
1957 any(target_arch = "mips64", target_arch = "mips64r6")
1958 ),
1959 link_name = "cfsetospeed@GLIBC_2.0"
1960 )]
1961 #[cfg_attr(
1962 all(
1963 target_os = "linux",
1964 target_env = "gnu",
1965 target_arch = "powerpc64",
1966 target_endian = "big"
1967 ),
1968 link_name = "cfsetospeed@GLIBC_2.3"
1969 )]
1970 #[cfg_attr(
1971 all(
1972 target_os = "linux",
1973 target_env = "gnu",
1974 target_arch = "powerpc64",
1975 target_endian = "little"
1976 ),
1977 link_name = "cfsetospeed@GLIBC_2.17"
1978 )]
1979 #[cfg_attr(
1980 all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"),
1981 link_name = "cfsetospeed@GLIBC_2.27"
1982 )]
1983 #[cfg_attr(
1984 all(target_os = "linux", target_env = "gnu", target_arch = "s390x"),
1985 link_name = "cfsetospeed@GLIBC_2.2"
1986 )]
1987 #[cfg_attr(
1988 all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"),
1989 link_name = "cfsetospeed@GLIBC_2.2"
1990 )]
1991 #[cfg_attr(
1992 all(
1993 target_os = "linux",
1994 target_env = "gnu",
1995 target_arch = "x86_64",
1996 target_pointer_width = "64"
1997 ),
1998 link_name = "cfsetospeed@GLIBC_2.2.5"
1999 )]
2000 #[cfg_attr(
2001 all(
2002 target_os = "linux",
2003 target_env = "gnu",
2004 target_arch = "x86_64",
2005 target_pointer_width = "32"
2006 ),
2007 link_name = "cfsetospeed@GLIBC_2.16"
2008 )]
2009 pub fn cfsetospeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
2010 #[cfg_attr(
2011 all(
2012 target_os = "linux",
2013 target_env = "gnu",
2014 any(
2015 target_arch = "mips",
2016 target_arch = "mips32r6",
2017 target_arch = "mips64",
2018 target_arch = "mips64r6",
2019 target_arch = "sparc"
2020 ),
2021 ),
2022 link_name = "tcgetattr@GLIBC_2.0"
2023 )]
2024 #[cfg_attr(
2025 all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"),
2026 link_name = "tcgetattr@GLIBC_2.2"
2027 )]
2028 pub fn tcgetattr(fd: c_int, termios: *mut crate::termios) -> c_int;
2029 #[cfg_attr(
2030 all(
2031 target_os = "linux",
2032 target_env = "gnu",
2033 any(
2034 target_arch = "mips",
2035 target_arch = "mips32r6",
2036 target_arch = "mips64",
2037 target_arch = "mips64r6",
2038 target_arch = "sparc"
2039 ),
2040 ),
2041 link_name = "tcsetattr@GLIBC_2.0"
2042 )]
2043 #[cfg_attr(
2044 all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"),
2045 link_name = "tcsetattr@GLIBC_2.2"
2046 )]
2047 pub fn tcsetattr(fd: c_int, optional_actions: c_int, termios: *const crate::termios) -> c_int;
2048 pub fn tcflow(fd: c_int, action: c_int) -> c_int;
2049 pub fn tcflush(fd: c_int, action: c_int) -> c_int;
2050 pub fn tcgetsid(fd: c_int) -> crate::pid_t;
2051 pub fn tcsendbreak(fd: c_int, duration: c_int) -> c_int;
2052 #[cfg_attr(gnu_file_offset_bits64, link_name = "mkstemp64")]
2053 pub fn mkstemp(template: *mut c_char) -> c_int;
2054 pub fn mkdtemp(template: *mut c_char) -> *mut c_char;
2055
2056 pub fn tmpnam(ptr: *mut c_char) -> *mut c_char;
2057
2058 pub fn openlog(ident: *const c_char, logopt: c_int, facility: c_int);
2059 pub fn closelog();
2060 pub fn setlogmask(maskpri: c_int) -> c_int;
2061 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
2062 pub fn syslog(priority: c_int, message: *const c_char, ...);
2063 #[cfg_attr(
2064 all(target_os = "macos", target_arch = "x86"),
2065 link_name = "nice$UNIX2003"
2066 )]
2067 pub fn nice(incr: c_int) -> c_int;
2068
2069 #[cfg(not(target_os = "l4re"))]
2070 pub fn grantpt(fd: c_int) -> c_int;
2071 #[cfg(not(target_os = "l4re"))]
2072 pub fn posix_openpt(flags: c_int) -> c_int;
2073 #[cfg(not(target_os = "l4re"))]
2074 pub fn ptsname(fd: c_int) -> *mut c_char;
2075 #[cfg(not(target_os = "l4re"))]
2076 pub fn unlockpt(fd: c_int) -> c_int;
2077
2078 #[cfg(not(target_os = "aix"))]
2079 pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
2080 pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
2081
2082 #[cfg_attr(gnu_file_offset_bits64, link_name = "lockf64")]
2083 pub fn lockf(fd: c_int, cmd: c_int, len: off_t) -> c_int;
2084
2085}
2086
2087safe_f! {
2088 pub const fn htonl(hostlong: u32) -> u32 {
2091 u32::to_be(hostlong)
2092 }
2093 pub const fn htons(hostshort: u16) -> u16 {
2094 u16::to_be(hostshort)
2095 }
2096 pub const fn ntohl(netlong: u32) -> u32 {
2097 u32::from_be(netlong)
2098 }
2099 pub const fn ntohs(netshort: u16) -> u16 {
2100 u16::from_be(netshort)
2101 }
2102}
2103
2104cfg_if! {
2105 if #[cfg(not(any(
2106 target_os = "emscripten",
2107 target_os = "android",
2108 target_os = "haiku",
2109 target_os = "nto",
2110 target_os = "solaris",
2111 target_os = "cygwin",
2112 target_os = "aix",
2113 target_os = "l4re",
2114 )))] {
2115 extern "C" {
2116 #[cfg_attr(target_os = "netbsd", link_name = "__adjtime50")]
2117 #[cfg_attr(any(gnu_time_bits64, musl32_time64), link_name = "__adjtime64")]
2118 pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> c_int;
2119 }
2120 } else if #[cfg(target_os = "solaris")] {
2121 extern "C" {
2122 pub fn adjtime(delta: *mut timeval, olddelta: *mut timeval) -> c_int;
2123 }
2124 }
2125}
2126
2127cfg_if! {
2128 if #[cfg(not(any(
2129 target_os = "emscripten",
2130 target_os = "android",
2131 target_os = "nto"
2132 )))] {
2133 extern "C" {
2134 pub fn stpncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
2135 }
2136 }
2137}
2138
2139cfg_if! {
2140 if #[cfg(not(any(
2141 target_os = "dragonfly",
2142 target_os = "emscripten",
2143 target_os = "hurd",
2144 target_os = "macos",
2145 target_os = "openbsd",
2146 target_os = "l4re",
2147 )))] {
2148 extern "C" {
2149 pub fn sigqueue(pid: pid_t, sig: c_int, value: crate::sigval) -> c_int;
2150 }
2151 }
2152}
2153
2154cfg_if! {
2155 if #[cfg(not(target_os = "android"))] {
2156 extern "C" {
2157 #[cfg_attr(
2158 all(target_os = "macos", target_arch = "x86"),
2159 link_name = "confstr$UNIX2003"
2160 )]
2161 #[cfg_attr(target_os = "solaris", link_name = "__confstr_xpg7")]
2162 pub fn confstr(name: c_int, buf: *mut c_char, len: size_t) -> size_t;
2163 }
2164 }
2165}
2166
2167cfg_if! {
2168 if #[cfg(not(target_os = "aix"))] {
2169 extern "C" {
2170 pub fn dladdr(addr: *const c_void, info: *mut Dl_info) -> c_int;
2171 }
2172 }
2173}
2174
2175cfg_if! {
2176 if #[cfg(not(target_os = "solaris"))] {
2177 extern "C" {
2178 pub fn flock(fd: c_int, operation: c_int) -> c_int;
2179 }
2180 }
2181}
2182
2183cfg_if! {
2184 if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] {
2185 extern "C" {
2186 pub fn open_wmemstream(ptr: *mut *mut wchar_t, sizeloc: *mut size_t) -> *mut FILE;
2187 }
2188 }
2189}
2190
2191cfg_if! {
2192 if #[cfg(not(target_os = "redox"))] {
2193 extern "C" {
2194 pub fn getsid(pid: pid_t) -> pid_t;
2195 #[cfg_attr(
2196 all(target_os = "macos", target_arch = "x86"),
2197 link_name = "pause$UNIX2003"
2198 )]
2199 pub fn pause() -> c_int;
2200
2201 #[cfg(not(target_os = "l4re"))]
2202 pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
2203 #[cfg_attr(gnu_file_offset_bits64, link_name = "openat64")]
2204 pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int;
2205
2206 #[cfg_attr(
2207 all(target_os = "macos", target_arch = "x86_64"),
2208 link_name = "fdopendir$INODE64"
2209 )]
2210 #[cfg_attr(
2211 all(target_os = "macos", target_arch = "x86"),
2212 link_name = "fdopendir$INODE64$UNIX2003"
2213 )]
2214 pub fn fdopendir(fd: c_int) -> *mut crate::DIR;
2215
2216 #[cfg_attr(
2217 all(target_os = "macos", not(target_arch = "aarch64")),
2218 link_name = "readdir_r$INODE64"
2219 )]
2220 #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
2221 #[cfg_attr(
2222 all(target_os = "freebsd", any(freebsd11, freebsd10)),
2223 link_name = "readdir_r@FBSD_1.0"
2224 )]
2225 #[cfg_attr(
2226 all(target_os = "freebsd", not(any(freebsd11, freebsd10))),
2227 link_name = "readdir_r@FBSD_1.5"
2228 )]
2229 #[allow(non_autolinks)] #[cfg_attr(gnu_file_offset_bits64, link_name = "readdir64_r")]
2237 pub fn readdir_r(
2238 dirp: *mut crate::DIR,
2239 entry: *mut crate::dirent,
2240 result: *mut *mut crate::dirent,
2241 ) -> c_int;
2242 }
2243 }
2244}
2245
2246cfg_if! {
2247 if #[cfg(target_os = "nto")] {
2248 extern "C" {
2249 pub fn readlinkat(
2250 dirfd: c_int,
2251 pathname: *const c_char,
2252 buf: *mut c_char,
2253 bufsiz: size_t,
2254 ) -> c_int;
2255 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: size_t) -> c_int;
2256 pub fn pselect(
2257 nfds: c_int,
2258 readfds: *mut fd_set,
2259 writefds: *mut fd_set,
2260 errorfds: *mut fd_set,
2261 timeout: *mut timespec,
2262 sigmask: *const sigset_t,
2263 ) -> c_int;
2264 pub fn sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction)
2265 -> c_int;
2266 }
2267 } else {
2268 extern "C" {
2269 #[cfg(not(target_os = "l4re"))]
2270 pub fn readlinkat(
2271 dirfd: c_int,
2272 pathname: *const c_char,
2273 buf: *mut c_char,
2274 bufsiz: size_t,
2275 ) -> ssize_t;
2276 #[cfg(not(target_os = "l4re"))]
2277 pub fn fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE;
2278 #[cfg(not(target_os = "l4re"))]
2279 pub fn open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE;
2280 pub fn atexit(cb: extern "C" fn()) -> c_int;
2281 #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
2282 pub fn sigaction(signum: c_int, act: *const sigaction, oldact: *mut sigaction)
2283 -> c_int;
2284 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: size_t) -> ssize_t;
2285 #[cfg_attr(
2286 all(target_os = "macos", target_arch = "x86_64"),
2287 link_name = "pselect$1050"
2288 )]
2289 #[cfg_attr(
2290 all(target_os = "macos", target_arch = "x86"),
2291 link_name = "pselect$UNIX2003"
2292 )]
2293 #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
2294 #[cfg_attr(gnu_time_bits64, link_name = "__pselect64")]
2295 #[cfg_attr(musl32_time64, link_name = "__pselect_time64")]
2296 pub fn pselect(
2297 nfds: c_int,
2298 readfds: *mut fd_set,
2299 writefds: *mut fd_set,
2300 errorfds: *mut fd_set,
2301 timeout: *const timespec,
2302 sigmask: *const sigset_t,
2303 ) -> c_int;
2304 }
2305 }
2306}
2307
2308cfg_if! {
2309 if #[cfg(any(target_os = "aix", target_os = "nto"))] {
2310 extern "C" {
2311 pub fn cfmakeraw(termios: *mut crate::termios) -> c_int;
2312 }
2313 } else if #[cfg(not(any(target_os = "solaris", target_os = "illumos",)))] {
2314 extern "C" {
2315 pub fn cfmakeraw(termios: *mut crate::termios);
2316 }
2317 }
2318}
2319
2320cfg_if! {
2321 if #[cfg(any(
2322 target_os = "aix",
2323 all(target_os = "nto", target_env = "nto80")
2324 ))] {
2325 extern "C" {
2326 pub fn cfsetspeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
2327 }
2328 } else if #[cfg(not(any(
2329 target_os = "solaris",
2330 target_os = "illumos",
2331 target_os = "nto"
2332 )))] {
2333 extern "C" {
2334 #[cfg(not(target_os = "l4re"))]
2335 #[cfg_attr(
2336 all(target_os = "linux", target_env = "gnu", target_arch = "arm"),
2337 link_name = "cfsetspeed@GLIBC_2.4"
2338 )]
2339 #[cfg_attr(
2340 all(target_os = "linux", target_env = "gnu", target_arch = "csky"),
2341 link_name = "cfsetspeed@GLIBC_2.29"
2342 )]
2343 #[cfg_attr(
2344 all(target_os = "linux", target_env = "gnu", target_arch = "m68k"),
2345 link_name = "cfsetspeed@GLIBC_2.0"
2346 )]
2347 #[cfg_attr(
2348 all(
2349 target_os = "linux",
2350 target_env = "gnu",
2351 any(target_arch = "mips", target_arch = "mips32r6")
2352 ),
2353 link_name = "cfsetspeed@GLIBC_2.0"
2354 )]
2355 #[cfg_attr(
2356 all(target_os = "linux", target_env = "gnu", target_arch = "powerpc"),
2357 link_name = "cfsetspeed@GLIBC_2.0"
2358 )]
2359 #[cfg_attr(
2360 all(target_os = "linux", target_env = "gnu", target_arch = "riscv32"),
2361 link_name = "cfsetspeed@GLIBC_2.33"
2362 )]
2363 #[cfg_attr(
2364 all(target_os = "linux", target_env = "gnu", target_arch = "sparc"),
2365 link_name = "cfsetspeed@GLIBC_2.0"
2366 )]
2367 #[cfg_attr(
2368 all(target_os = "linux", target_env = "gnu", target_arch = "x86"),
2369 link_name = "cfsetspeed@GLIBC_2.0"
2370 )]
2371 #[cfg_attr(
2372 all(target_os = "linux", target_env = "gnu", target_arch = "aarch64"),
2373 link_name = "cfsetspeed@GLIBC_2.17"
2374 )]
2375 #[cfg_attr(
2376 all(target_os = "linux", target_env = "gnu", target_arch = "loongarch64"),
2377 link_name = "cfsetspeed@GLIBC_2.36"
2378 )]
2379 #[cfg_attr(
2380 all(
2381 target_os = "linux",
2382 target_env = "gnu",
2383 any(target_arch = "mips64", target_arch = "mips64r6")
2384 ),
2385 link_name = "cfsetspeed@GLIBC_2.0"
2386 )]
2387 #[cfg_attr(
2388 all(
2389 target_os = "linux",
2390 target_env = "gnu",
2391 target_arch = "powerpc64",
2392 target_endian = "big"
2393 ),
2394 link_name = "cfsetspeed@GLIBC_2.3"
2395 )]
2396 #[cfg_attr(
2397 all(
2398 target_os = "linux",
2399 target_env = "gnu",
2400 target_arch = "powerpc64",
2401 target_endian = "little"
2402 ),
2403 link_name = "cfsetspeed@GLIBC_2.17"
2404 )]
2405 #[cfg_attr(
2406 all(target_os = "linux", target_env = "gnu", target_arch = "riscv64"),
2407 link_name = "cfsetspeed@GLIBC_2.27"
2408 )]
2409 #[cfg_attr(
2410 all(target_os = "linux", target_env = "gnu", target_arch = "s390x"),
2411 link_name = "cfsetspeed@GLIBC_2.2"
2412 )]
2413 #[cfg_attr(
2414 all(target_os = "linux", target_env = "gnu", target_arch = "sparc64"),
2415 link_name = "cfsetspeed@GLIBC_2.2"
2416 )]
2417 #[cfg_attr(
2418 all(
2419 target_os = "linux",
2420 target_env = "gnu",
2421 target_arch = "x86_64",
2422 target_pointer_width = "64"
2423 ),
2424 link_name = "cfsetspeed@GLIBC_2.2.5"
2425 )]
2426 #[cfg_attr(
2427 all(
2428 target_os = "linux",
2429 target_env = "gnu",
2430 target_arch = "x86_64",
2431 target_pointer_width = "32"
2432 ),
2433 link_name = "cfsetspeed@GLIBC_2.16"
2434 )]
2435 pub fn cfsetspeed(termios: *mut crate::termios, speed: crate::speed_t) -> c_int;
2436 }
2437 }
2438}
2439
2440extern "C" {
2441 pub fn fnmatch(pattern: *const c_char, name: *const c_char, flags: c_int) -> c_int;
2442}
2443
2444cfg_if! {
2445 if #[cfg(target_env = "newlib")] {
2446 mod newlib;
2447 pub use self::newlib::*;
2448 } else if #[cfg(any(
2449 target_os = "linux",
2450 target_os = "l4re",
2451 target_os = "android",
2452 target_os = "emscripten"
2453 ))] {
2454 mod linux_like;
2455 pub use self::linux_like::*;
2456 } else if #[cfg(any(
2457 target_os = "macos",
2458 target_os = "ios",
2459 target_os = "tvos",
2460 target_os = "watchos",
2461 target_os = "visionos",
2462 target_os = "freebsd",
2463 target_os = "dragonfly",
2464 target_os = "openbsd",
2465 target_os = "netbsd"
2466 ))] {
2467 mod bsd;
2468 pub use self::bsd::*;
2469 } else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] {
2470 mod solarish;
2471 pub use self::solarish::*;
2472 } else if #[cfg(target_os = "haiku")] {
2473 mod haiku;
2474 pub use self::haiku::*;
2475 } else if #[cfg(target_os = "redox")] {
2476 mod redox;
2477 pub use self::redox::*;
2478 } else if #[cfg(target_os = "cygwin")] {
2479 mod cygwin;
2480 pub use self::cygwin::*;
2481 } else if #[cfg(target_os = "nto")] {
2482 mod nto;
2483 pub use self::nto::*;
2484 } else if #[cfg(target_os = "aix")] {
2485 mod aix;
2486 pub use self::aix::*;
2487 } else if #[cfg(target_os = "hurd")] {
2488 mod hurd;
2489 pub use self::hurd::*;
2490 } else if #[cfg(target_os = "nuttx")] {
2491 mod nuttx;
2492 pub use self::nuttx::*;
2493 } else {
2494 }
2496}