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