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