1 //! Definitions found commonly among almost all Unix derivatives
2 //!
3 //! More functions and definitions can be found in the more specific modules
4 //! according to the platform in question.
5 
6 pub type c_schar = i8;
7 pub type c_uchar = u8;
8 pub type c_short = i16;
9 pub type c_ushort = u16;
10 pub type c_int = i32;
11 pub type c_uint = u32;
12 pub type c_float = f32;
13 pub type c_double = f64;
14 pub type c_longlong = i64;
15 pub type c_ulonglong = u64;
16 pub type intmax_t = i64;
17 pub type uintmax_t = u64;
18 
19 pub type size_t = usize;
20 pub type ptrdiff_t = isize;
21 pub type intptr_t = isize;
22 pub type uintptr_t = usize;
23 pub type ssize_t = isize;
24 
25 pub type pid_t = i32;
26 pub type in_addr_t = u32;
27 pub type in_port_t = u16;
28 pub type sighandler_t = ::size_t;
29 pub type cc_t = ::c_uchar;
30 
31 cfg_if! {
32     if #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] {
33         pub type uid_t = ::c_ushort;
34         pub type gid_t = ::c_ushort;
35     } else if #[cfg(target_os = "nto")] {
36         pub type uid_t = i32;
37         pub type gid_t = i32;
38     } else {
39         pub type uid_t = u32;
40         pub type gid_t = u32;
41     }
42 }
43 
44 missing! {
45     #[cfg_attr(feature = "extra_traits", derive(Debug))]
46     pub enum DIR {}
47 }
48 pub type locale_t = *mut ::c_void;
49 
50 s! {
51     pub struct group {
52         pub gr_name: *mut ::c_char,
53         pub gr_passwd: *mut ::c_char,
54         pub gr_gid: ::gid_t,
55         pub gr_mem: *mut *mut ::c_char,
56     }
57 
58     pub struct utimbuf {
59         pub actime: time_t,
60         pub modtime: time_t,
61     }
62 
63     pub struct timeval {
64         pub tv_sec: time_t,
65         pub tv_usec: suseconds_t,
66     }
67 
68     // linux x32 compatibility
69     // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
70     pub struct timespec {
71         pub tv_sec: time_t,
72         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
73         pub tv_nsec: i64,
74         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
75         pub tv_nsec: ::c_long,
76     }
77 
78     pub struct rlimit {
79         pub rlim_cur: rlim_t,
80         pub rlim_max: rlim_t,
81     }
82 
83     pub struct rusage {
84         pub ru_utime: timeval,
85         pub ru_stime: timeval,
86         pub ru_maxrss: c_long,
87         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
88         __pad1: u32,
89         pub ru_ixrss: c_long,
90         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
91         __pad2: u32,
92         pub ru_idrss: c_long,
93         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
94         __pad3: u32,
95         pub ru_isrss: c_long,
96         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
97         __pad4: u32,
98         pub ru_minflt: c_long,
99         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
100         __pad5: u32,
101         pub ru_majflt: c_long,
102         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
103         __pad6: u32,
104         pub ru_nswap: c_long,
105         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
106         __pad7: u32,
107         pub ru_inblock: c_long,
108         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
109         __pad8: u32,
110         pub ru_oublock: c_long,
111         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
112         __pad9: u32,
113         pub ru_msgsnd: c_long,
114         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
115         __pad10: u32,
116         pub ru_msgrcv: c_long,
117         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
118         __pad11: u32,
119         pub ru_nsignals: c_long,
120         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
121         __pad12: u32,
122         pub ru_nvcsw: c_long,
123         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
124         __pad13: u32,
125         pub ru_nivcsw: c_long,
126         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
127         __pad14: u32,
128 
129         #[cfg(any(target_env = "musl", target_env = "ohos", target_os = "emscripten"))]
130         __reserved: [c_long; 16],
131     }
132 
133     pub struct ipv6_mreq {
134         pub ipv6mr_multiaddr: in6_addr,
135         #[cfg(target_os = "android")]
136         pub ipv6mr_interface: ::c_int,
137         #[cfg(not(target_os = "android"))]
138         pub ipv6mr_interface: ::c_uint,
139     }
140 
141     pub struct hostent {
142         pub h_name: *mut ::c_char,
143         pub h_aliases: *mut *mut ::c_char,
144         pub h_addrtype: ::c_int,
145         pub h_length: ::c_int,
146         pub h_addr_list: *mut *mut ::c_char,
147     }
148 
149     pub struct iovec {
150         pub iov_base: *mut ::c_void,
151         pub iov_len: ::size_t,
152     }
153 
154     pub struct pollfd {
155         pub fd: ::c_int,
156         pub events: ::c_short,
157         pub revents: ::c_short,
158     }
159 
160     pub struct winsize {
161         pub ws_row: ::c_ushort,
162         pub ws_col: ::c_ushort,
163         pub ws_xpixel: ::c_ushort,
164         pub ws_ypixel: ::c_ushort,
165     }
166 
167     pub struct linger {
168         pub l_onoff: ::c_int,
169         pub l_linger: ::c_int,
170     }
171 
172     pub struct sigval {
173         // Actually a union of an int and a void*
174         pub sival_ptr: *mut ::c_void
175     }
176 
177     // <sys/time.h>
178     pub struct itimerval {
179         pub it_interval: ::timeval,
180         pub it_value: ::timeval,
181     }
182 
183     // <sys/times.h>
184     pub struct tms {
185         pub tms_utime: ::clock_t,
186         pub tms_stime: ::clock_t,
187         pub tms_cutime: ::clock_t,
188         pub tms_cstime: ::clock_t,
189     }
190 
191     pub struct servent {
192         pub s_name: *mut ::c_char,
193         pub s_aliases: *mut *mut ::c_char,
194         pub s_port: ::c_int,
195         pub s_proto: *mut ::c_char,
196     }
197 
198     pub struct protoent {
199         pub p_name: *mut ::c_char,
200         pub p_aliases: *mut *mut ::c_char,
201         pub p_proto: ::c_int,
202     }
203 }
204 
205 pub const INT_MIN: c_int = -2147483648;
206 pub const INT_MAX: c_int = 2147483647;
207 
208 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
209 pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
210 pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
211 cfg_if! {
212     if #[cfg(not(target_os = "nto"))] {
213         pub const DT_UNKNOWN: u8 = 0;
214         pub const DT_FIFO: u8 = 1;
215         pub const DT_CHR: u8 = 2;
216         pub const DT_DIR: u8 = 4;
217         pub const DT_BLK: u8 = 6;
218         pub const DT_REG: u8 = 8;
219         pub const DT_LNK: u8 = 10;
220         pub const DT_SOCK: u8 = 12;
221     }
222 }
223 cfg_if! {
224     if #[cfg(not(target_os = "redox"))] {
225         pub const FD_CLOEXEC: ::c_int = 0x1;
226     }
227 }
228 
229 cfg_if! {
230     if #[cfg(not(target_os = "nto"))]
231     {
232         pub const USRQUOTA: ::c_int = 0;
233         pub const GRPQUOTA: ::c_int = 1;
234     }
235 }
236 pub const SIGIOT: ::c_int = 6;
237 
238 pub const S_ISUID: ::mode_t = 0x800;
239 pub const S_ISGID: ::mode_t = 0x400;
240 pub const S_ISVTX: ::mode_t = 0x200;
241 
242 cfg_if! {
243     if #[cfg(not(any(target_os = "haiku", target_os = "illumos",
244                      target_os = "solaris")))] {
245         pub const IF_NAMESIZE: ::size_t = 16;
246         pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
247     }
248 }
249 
250 pub const LOG_EMERG: ::c_int = 0;
251 pub const LOG_ALERT: ::c_int = 1;
252 pub const LOG_CRIT: ::c_int = 2;
253 pub const LOG_ERR: ::c_int = 3;
254 pub const LOG_WARNING: ::c_int = 4;
255 pub const LOG_NOTICE: ::c_int = 5;
256 pub const LOG_INFO: ::c_int = 6;
257 pub const LOG_DEBUG: ::c_int = 7;
258 
259 pub const LOG_KERN: ::c_int = 0;
260 pub const LOG_USER: ::c_int = 1 << 3;
261 pub const LOG_MAIL: ::c_int = 2 << 3;
262 pub const LOG_DAEMON: ::c_int = 3 << 3;
263 pub const LOG_AUTH: ::c_int = 4 << 3;
264 pub const LOG_SYSLOG: ::c_int = 5 << 3;
265 pub const LOG_LPR: ::c_int = 6 << 3;
266 pub const LOG_NEWS: ::c_int = 7 << 3;
267 pub const LOG_UUCP: ::c_int = 8 << 3;
268 pub const LOG_LOCAL0: ::c_int = 16 << 3;
269 pub const LOG_LOCAL1: ::c_int = 17 << 3;
270 pub const LOG_LOCAL2: ::c_int = 18 << 3;
271 pub const LOG_LOCAL3: ::c_int = 19 << 3;
272 pub const LOG_LOCAL4: ::c_int = 20 << 3;
273 pub const LOG_LOCAL5: ::c_int = 21 << 3;
274 pub const LOG_LOCAL6: ::c_int = 22 << 3;
275 pub const LOG_LOCAL7: ::c_int = 23 << 3;
276 
277 cfg_if! {
278     if #[cfg(not(target_os = "haiku"))] {
279         pub const LOG_PID: ::c_int = 0x01;
280         pub const LOG_CONS: ::c_int = 0x02;
281         pub const LOG_ODELAY: ::c_int = 0x04;
282         pub const LOG_NDELAY: ::c_int = 0x08;
283         pub const LOG_NOWAIT: ::c_int = 0x10;
284     }
285 }
286 pub const LOG_PRIMASK: ::c_int = 7;
287 pub const LOG_FACMASK: ::c_int = 0x3f8;
288 
289 cfg_if! {
290     if #[cfg(not(target_os = "nto"))]
291     {
292         pub const PRIO_MIN: ::c_int = -20;
293         pub const PRIO_MAX: ::c_int = 20;
294     }
295 }
296 pub const IPPROTO_ICMP: ::c_int = 1;
297 pub const IPPROTO_ICMPV6: ::c_int = 58;
298 pub const IPPROTO_TCP: ::c_int = 6;
299 pub const IPPROTO_UDP: ::c_int = 17;
300 pub const IPPROTO_IP: ::c_int = 0;
301 pub const IPPROTO_IPV6: ::c_int = 41;
302 
303 pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
304 pub const INADDR_ANY: in_addr_t = 0;
305 pub const INADDR_BROADCAST: in_addr_t = 4294967295;
306 pub const INADDR_NONE: in_addr_t = 4294967295;
307 
308 pub const ARPOP_REQUEST: u16 = 1;
309 pub const ARPOP_REPLY: u16 = 2;
310 
311 pub const ATF_COM: ::c_int = 0x02;
312 pub const ATF_PERM: ::c_int = 0x04;
313 pub const ATF_PUBL: ::c_int = 0x08;
314 pub const ATF_USETRAILERS: ::c_int = 0x10;
315 
316 pub const FNM_PERIOD: c_int = 1 << 2;
317 pub const FNM_CASEFOLD: c_int = 1 << 4;
318 pub const FNM_NOMATCH: c_int = 1;
319 
320 cfg_if! {
321     if #[cfg(any(
322         target_os = "macos",
323         target_os = "freebsd",
324         target_os = "android",
325         target_os = "openbsd",
326     ))] {
327         pub const FNM_PATHNAME: c_int = 1 << 1;
328         pub const FNM_NOESCAPE: c_int = 1 << 0;
329     } else {
330         pub const FNM_PATHNAME: c_int = 1 << 0;
331         pub const FNM_NOESCAPE: c_int = 1 << 1;
332     }
333 }
334 
335 extern "C" {
336     pub static in6addr_loopback: in6_addr;
337     pub static in6addr_any: in6_addr;
338 }
339 
340 cfg_if! {
341     if #[cfg(any(target_os = "l4re", target_os = "espidf", target_os = "nuttx"))] {
342         // required libraries are linked externally for these platforms:
343         // * L4Re
344         // * ESP-IDF
345         // * NuttX
346     } else if #[cfg(feature = "std")] {
347         // cargo build, don't pull in anything extra as the std dep
348         // already pulls in all libs.
349     } else if #[cfg(all(target_os = "linux",
350                         any(target_env = "gnu", target_env = "uclibc"),
351                         feature = "rustc-dep-of-std"))] {
352         #[link(name = "util", kind = "static", modifiers = "-bundle",
353             cfg(target_feature = "crt-static"))]
354         #[link(name = "rt", kind = "static", modifiers = "-bundle",
355             cfg(target_feature = "crt-static"))]
356         #[link(name = "pthread", kind = "static", modifiers = "-bundle",
357             cfg(target_feature = "crt-static"))]
358         #[link(name = "m", kind = "static", modifiers = "-bundle",
359             cfg(target_feature = "crt-static"))]
360         #[link(name = "dl", kind = "static", modifiers = "-bundle",
361             cfg(target_feature = "crt-static"))]
362         #[link(name = "c", kind = "static", modifiers = "-bundle",
363             cfg(target_feature = "crt-static"))]
364         #[link(name = "gcc_eh", kind = "static", modifiers = "-bundle",
365             cfg(target_feature = "crt-static"))]
366         #[link(name = "gcc", kind = "static", modifiers = "-bundle",
367             cfg(target_feature = "crt-static"))]
368         #[link(name = "c", kind = "static", modifiers = "-bundle",
369             cfg(target_feature = "crt-static"))]
370         #[link(name = "util", cfg(not(target_feature = "crt-static")))]
371         #[link(name = "rt", cfg(not(target_feature = "crt-static")))]
372         #[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
373         #[link(name = "m", cfg(not(target_feature = "crt-static")))]
374         #[link(name = "dl", cfg(not(target_feature = "crt-static")))]
375         #[link(name = "c", cfg(not(target_feature = "crt-static")))]
376         extern {}
377     } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
378         #[cfg_attr(feature = "rustc-dep-of-std",
379                    link(name = "c", kind = "static", modifiers = "-bundle",
380                         cfg(target_feature = "crt-static")))]
381         #[cfg_attr(feature = "rustc-dep-of-std",
382                    link(name = "c", cfg(not(target_feature = "crt-static"))))]
383         extern {}
384     } else if #[cfg(target_os = "emscripten")] {
385         #[link(name = "c")]
386         extern {}
387     } else if #[cfg(all(target_os = "android", feature = "rustc-dep-of-std"))] {
388         #[link(name = "c", kind = "static", modifiers = "-bundle",
389             cfg(target_feature = "crt-static"))]
390         #[link(name = "m", kind = "static", modifiers = "-bundle",
391             cfg(target_feature = "crt-static"))]
392         #[link(name = "m", cfg(not(target_feature = "crt-static")))]
393         #[link(name = "c", cfg(not(target_feature = "crt-static")))]
394         extern {}
395     } else if #[cfg(any(target_os = "macos",
396                         target_os = "ios",
397                         target_os = "tvos",
398                         target_os = "watchos",
399                         target_os = "visionos",
400                         target_os = "android",
401                         target_os = "openbsd",
402                         target_os = "nto",
403                     ))] {
404         #[link(name = "c")]
405         #[link(name = "m")]
406         extern {}
407     } else if #[cfg(target_os = "haiku")] {
408         #[link(name = "root")]
409         #[link(name = "network")]
410         extern {}
411     } else if #[cfg(target_env = "newlib")] {
412         #[link(name = "c")]
413         #[link(name = "m")]
414         extern {}
415     } else if #[cfg(target_env = "illumos")] {
416         #[link(name = "c")]
417         #[link(name = "m")]
418         extern {}
419     } else if #[cfg(target_os = "redox")] {
420         #[cfg_attr(feature = "rustc-dep-of-std",
421                    link(name = "c", kind = "static", modifiers = "-bundle",
422                         cfg(target_feature = "crt-static")))]
423         #[cfg_attr(feature = "rustc-dep-of-std",
424                    link(name = "c", cfg(not(target_feature = "crt-static"))))]
425         extern {}
426     } else if #[cfg(target_os = "aix")] {
427         #[link(name = "c")]
428         #[link(name = "m")]
429         #[link(name = "bsd")]
430         #[link(name = "pthread")]
431         extern {}
432     } else {
433         #[link(name = "c")]
434         #[link(name = "m")]
435         #[link(name = "rt")]
436         #[link(name = "pthread")]
437         extern {}
438     }
439 }
440 
441 missing! {
442     #[cfg_attr(feature = "extra_traits", derive(Debug))]
443     pub enum FILE {}
444     #[cfg_attr(feature = "extra_traits", derive(Debug))]
445     pub enum fpos_t {} // FIXME: fill this out with a struct
446 }
447 
448 extern "C" {
isalnum(c: c_int) -> c_int449     pub fn isalnum(c: c_int) -> c_int;
isalpha(c: c_int) -> c_int450     pub fn isalpha(c: c_int) -> c_int;
iscntrl(c: c_int) -> c_int451     pub fn iscntrl(c: c_int) -> c_int;
isdigit(c: c_int) -> c_int452     pub fn isdigit(c: c_int) -> c_int;
isgraph(c: c_int) -> c_int453     pub fn isgraph(c: c_int) -> c_int;
islower(c: c_int) -> c_int454     pub fn islower(c: c_int) -> c_int;
isprint(c: c_int) -> c_int455     pub fn isprint(c: c_int) -> c_int;
ispunct(c: c_int) -> c_int456     pub fn ispunct(c: c_int) -> c_int;
isspace(c: c_int) -> c_int457     pub fn isspace(c: c_int) -> c_int;
isupper(c: c_int) -> c_int458     pub fn isupper(c: c_int) -> c_int;
isxdigit(c: c_int) -> c_int459     pub fn isxdigit(c: c_int) -> c_int;
isblank(c: c_int) -> c_int460     pub fn isblank(c: c_int) -> c_int;
tolower(c: c_int) -> c_int461     pub fn tolower(c: c_int) -> c_int;
toupper(c: c_int) -> c_int462     pub fn toupper(c: c_int) -> c_int;
qsort( base: *mut c_void, num: size_t, size: size_t, compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, )463     pub fn qsort(
464         base: *mut c_void,
465         num: size_t,
466         size: size_t,
467         compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
468     );
bsearch( key: *const c_void, base: *const c_void, num: size_t, size: size_t, compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, ) -> *mut c_void469     pub fn bsearch(
470         key: *const c_void,
471         base: *const c_void,
472         num: size_t,
473         size: size_t,
474         compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
475     ) -> *mut c_void;
476     #[cfg_attr(
477         all(target_os = "macos", target_arch = "x86"),
478         link_name = "fopen$UNIX2003"
479     )]
fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE480     pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
481     #[cfg_attr(
482         all(target_os = "macos", target_arch = "x86"),
483         link_name = "freopen$UNIX2003"
484     )]
freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE485     pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
486 
fflush(file: *mut FILE) -> c_int487     pub fn fflush(file: *mut FILE) -> c_int;
fclose(file: *mut FILE) -> c_int488     pub fn fclose(file: *mut FILE) -> c_int;
remove(filename: *const c_char) -> c_int489     pub fn remove(filename: *const c_char) -> c_int;
rename(oldname: *const c_char, newname: *const c_char) -> c_int490     pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
tmpfile() -> *mut FILE491     pub fn tmpfile() -> *mut FILE;
setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int492     pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
setbuf(stream: *mut FILE, buf: *mut c_char)493     pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
getchar() -> c_int494     pub fn getchar() -> c_int;
putchar(c: c_int) -> c_int495     pub fn putchar(c: c_int) -> c_int;
fgetc(stream: *mut FILE) -> c_int496     pub fn fgetc(stream: *mut FILE) -> c_int;
fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char497     pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
fputc(c: c_int, stream: *mut FILE) -> c_int498     pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
499     #[cfg_attr(
500         all(target_os = "macos", target_arch = "x86"),
501         link_name = "fputs$UNIX2003"
502     )]
fputs(s: *const c_char, stream: *mut FILE) -> c_int503     pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
puts(s: *const c_char) -> c_int504     pub fn puts(s: *const c_char) -> c_int;
ungetc(c: c_int, stream: *mut FILE) -> c_int505     pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t506     pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
507     #[cfg_attr(
508         all(target_os = "macos", target_arch = "x86"),
509         link_name = "fwrite$UNIX2003"
510     )]
fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t511     pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int512     pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
ftell(stream: *mut FILE) -> c_long513     pub fn ftell(stream: *mut FILE) -> c_long;
rewind(stream: *mut FILE)514     pub fn rewind(stream: *mut FILE);
515     #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int516     pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
517     #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int518     pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
feof(stream: *mut FILE) -> c_int519     pub fn feof(stream: *mut FILE) -> c_int;
ferror(stream: *mut FILE) -> c_int520     pub fn ferror(stream: *mut FILE) -> c_int;
clearerr(stream: *mut FILE)521     pub fn clearerr(stream: *mut FILE);
perror(s: *const c_char)522     pub fn perror(s: *const c_char);
atof(s: *const c_char) -> c_double523     pub fn atof(s: *const c_char) -> c_double;
atoi(s: *const c_char) -> c_int524     pub fn atoi(s: *const c_char) -> c_int;
atol(s: *const c_char) -> c_long525     pub fn atol(s: *const c_char) -> c_long;
atoll(s: *const c_char) -> c_longlong526     pub fn atoll(s: *const c_char) -> c_longlong;
527     #[cfg_attr(
528         all(target_os = "macos", target_arch = "x86"),
529         link_name = "strtod$UNIX2003"
530     )]
strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double531     pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float532     pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float;
strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long533     pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong534     pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong;
strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong535     pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong536     pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong;
calloc(nobj: size_t, size: size_t) -> *mut c_void537     pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
malloc(size: size_t) -> *mut c_void538     pub fn malloc(size: size_t) -> *mut c_void;
realloc(p: *mut c_void, size: size_t) -> *mut c_void539     pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
free(p: *mut c_void)540     pub fn free(p: *mut c_void);
abort() -> !541     pub fn abort() -> !;
exit(status: c_int) -> !542     pub fn exit(status: c_int) -> !;
_exit(status: c_int) -> !543     pub fn _exit(status: c_int) -> !;
544     #[cfg_attr(
545         all(target_os = "macos", target_arch = "x86"),
546         link_name = "system$UNIX2003"
547     )]
system(s: *const c_char) -> c_int548     pub fn system(s: *const c_char) -> c_int;
getenv(s: *const c_char) -> *mut c_char549     pub fn getenv(s: *const c_char) -> *mut c_char;
550 
strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char551     pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char552     pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
stpcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char553     pub fn stpcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char554     pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char555     pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
strcmp(cs: *const c_char, ct: *const c_char) -> c_int556     pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int557     pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
strcoll(cs: *const c_char, ct: *const c_char) -> c_int558     pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
strchr(cs: *const c_char, c: c_int) -> *mut c_char559     pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
strrchr(cs: *const c_char, c: c_int) -> *mut c_char560     pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
strspn(cs: *const c_char, ct: *const c_char) -> size_t561     pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
strcspn(cs: *const c_char, ct: *const c_char) -> size_t562     pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
strdup(cs: *const c_char) -> *mut c_char563     pub fn strdup(cs: *const c_char) -> *mut c_char;
strndup(cs: *const c_char, n: size_t) -> *mut c_char564     pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char;
strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char565     pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char566     pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int567     pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int568     pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
strlen(cs: *const c_char) -> size_t569     pub fn strlen(cs: *const c_char) -> size_t;
strnlen(cs: *const c_char, maxlen: size_t) -> size_t570     pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
571     #[cfg_attr(
572         all(target_os = "macos", target_arch = "x86"),
573         link_name = "strerror$UNIX2003"
574     )]
strerror(n: c_int) -> *mut c_char575     pub fn strerror(n: c_int) -> *mut c_char;
strtok(s: *mut c_char, t: *const c_char) -> *mut c_char576     pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
strtok_r(s: *mut c_char, t: *const c_char, p: *mut *mut c_char) -> *mut c_char577     pub fn strtok_r(s: *mut c_char, t: *const c_char, p: *mut *mut c_char) -> *mut c_char;
strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t578     pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
strsignal(sig: c_int) -> *mut c_char579     pub fn strsignal(sig: c_int) -> *mut c_char;
wcslen(buf: *const wchar_t) -> size_t580     pub fn wcslen(buf: *const wchar_t) -> size_t;
wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t581     pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t;
582 
memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void583     pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t584     pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t;
memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int585     pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void586     pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void587     pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void588     pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
589 }
590 
591 extern "C" {
592     #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
getpwnam(name: *const ::c_char) -> *mut passwd593     pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
594     #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
getpwuid(uid: ::uid_t) -> *mut passwd595     pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
596 
fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int597     pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
printf(format: *const ::c_char, ...) -> ::c_int598     pub fn printf(format: *const ::c_char, ...) -> ::c_int;
snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int599     pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int;
sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int600     pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
601     #[cfg_attr(
602         all(target_os = "linux", not(target_env = "uclibc")),
603         link_name = "__isoc99_fscanf"
604     )]
fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int605     pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
606     #[cfg_attr(
607         all(target_os = "linux", not(target_env = "uclibc")),
608         link_name = "__isoc99_scanf"
609     )]
scanf(format: *const ::c_char, ...) -> ::c_int610     pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
611     #[cfg_attr(
612         all(target_os = "linux", not(target_env = "uclibc")),
613         link_name = "__isoc99_sscanf"
614     )]
sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int615     pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
getchar_unlocked() -> ::c_int616     pub fn getchar_unlocked() -> ::c_int;
putchar_unlocked(c: ::c_int) -> ::c_int617     pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
618 
619     #[cfg(not(all(
620         libc_cfg_target_vendor,
621         target_arch = "powerpc",
622         target_vendor = "nintendo"
623     )))]
624     #[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
625     #[cfg_attr(
626         any(target_os = "illumos", target_os = "solaris"),
627         link_name = "__xnet_socket"
628     )]
629     #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int630     pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
631     #[cfg(not(all(
632         libc_cfg_target_vendor,
633         target_arch = "powerpc",
634         target_vendor = "nintendo"
635     )))]
636     #[cfg_attr(
637         all(target_os = "macos", target_arch = "x86"),
638         link_name = "connect$UNIX2003"
639     )]
640     #[cfg_attr(
641         any(target_os = "illumos", target_os = "solaris"),
642         link_name = "__xnet_connect"
643     )]
644     #[cfg_attr(target_os = "espidf", link_name = "lwip_connect")]
connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int645     pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int;
646     #[cfg_attr(
647         all(target_os = "macos", target_arch = "x86"),
648         link_name = "listen$UNIX2003"
649     )]
650     #[cfg_attr(target_os = "espidf", link_name = "lwip_listen")]
listen(socket: ::c_int, backlog: ::c_int) -> ::c_int651     pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
652     #[cfg(not(all(
653         libc_cfg_target_vendor,
654         target_arch = "powerpc",
655         target_vendor = "nintendo"
656     )))]
657     #[cfg_attr(
658         all(target_os = "macos", target_arch = "x86"),
659         link_name = "accept$UNIX2003"
660     )]
661     #[cfg_attr(target_os = "espidf", link_name = "lwip_accept")]
accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int662     pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int;
663     #[cfg(not(all(
664         libc_cfg_target_vendor,
665         target_arch = "powerpc",
666         target_vendor = "nintendo"
667     )))]
668     #[cfg_attr(
669         all(target_os = "macos", target_arch = "x86"),
670         link_name = "getpeername$UNIX2003"
671     )]
672     #[cfg_attr(target_os = "espidf", link_name = "lwip_getpeername")]
getpeername( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int673     pub fn getpeername(
674         socket: ::c_int,
675         address: *mut sockaddr,
676         address_len: *mut socklen_t,
677     ) -> ::c_int;
678     #[cfg(not(all(
679         libc_cfg_target_vendor,
680         target_arch = "powerpc",
681         target_vendor = "nintendo"
682     )))]
683     #[cfg_attr(
684         all(target_os = "macos", target_arch = "x86"),
685         link_name = "getsockname$UNIX2003"
686     )]
687     #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockname")]
getsockname( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int688     pub fn getsockname(
689         socket: ::c_int,
690         address: *mut sockaddr,
691         address_len: *mut socklen_t,
692     ) -> ::c_int;
693     #[cfg_attr(target_os = "espidf", link_name = "lwip_setsockopt")]
setsockopt( socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, option_len: socklen_t, ) -> ::c_int694     pub fn setsockopt(
695         socket: ::c_int,
696         level: ::c_int,
697         name: ::c_int,
698         value: *const ::c_void,
699         option_len: socklen_t,
700     ) -> ::c_int;
701     #[cfg_attr(
702         all(target_os = "macos", target_arch = "x86"),
703         link_name = "socketpair$UNIX2003"
704     )]
705     #[cfg_attr(
706         any(target_os = "illumos", target_os = "solaris"),
707         link_name = "__xnet_socketpair"
708     )]
socketpair( domain: ::c_int, type_: ::c_int, protocol: ::c_int, socket_vector: *mut ::c_int, ) -> ::c_int709     pub fn socketpair(
710         domain: ::c_int,
711         type_: ::c_int,
712         protocol: ::c_int,
713         socket_vector: *mut ::c_int,
714     ) -> ::c_int;
715     #[cfg(not(all(
716         libc_cfg_target_vendor,
717         target_arch = "powerpc",
718         target_vendor = "nintendo"
719     )))]
720     #[cfg_attr(
721         all(target_os = "macos", target_arch = "x86"),
722         link_name = "sendto$UNIX2003"
723     )]
724     #[cfg_attr(
725         any(target_os = "illumos", target_os = "solaris"),
726         link_name = "__xnet_sendto"
727     )]
728     #[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")]
sendto( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, addr: *const sockaddr, addrlen: socklen_t, ) -> ::ssize_t729     pub fn sendto(
730         socket: ::c_int,
731         buf: *const ::c_void,
732         len: ::size_t,
733         flags: ::c_int,
734         addr: *const sockaddr,
735         addrlen: socklen_t,
736     ) -> ::ssize_t;
737     #[cfg_attr(target_os = "espidf", link_name = "lwip_shutdown")]
shutdown(socket: ::c_int, how: ::c_int) -> ::c_int738     pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
739 
740     #[cfg_attr(
741         all(target_os = "macos", target_arch = "x86"),
742         link_name = "chmod$UNIX2003"
743     )]
chmod(path: *const c_char, mode: mode_t) -> ::c_int744     pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int;
745     #[cfg_attr(
746         all(target_os = "macos", target_arch = "x86"),
747         link_name = "fchmod$UNIX2003"
748     )]
fchmod(fd: ::c_int, mode: mode_t) -> ::c_int749     pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
750 
751     #[cfg_attr(
752         all(target_os = "macos", not(target_arch = "aarch64")),
753         link_name = "fstat$INODE64"
754     )]
755     #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
756     #[cfg_attr(
757         all(target_os = "freebsd", any(freebsd11, freebsd10)),
758         link_name = "fstat@FBSD_1.0"
759     )]
fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int760     pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
761 
mkdir(path: *const c_char, mode: mode_t) -> ::c_int762     pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
763 
764     #[cfg_attr(
765         all(target_os = "macos", not(target_arch = "aarch64")),
766         link_name = "stat$INODE64"
767     )]
768     #[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
769     #[cfg_attr(
770         all(target_os = "freebsd", any(freebsd11, freebsd10)),
771         link_name = "stat@FBSD_1.0"
772     )]
stat(path: *const c_char, buf: *mut stat) -> ::c_int773     pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
774 
pclose(stream: *mut ::FILE) -> ::c_int775     pub fn pclose(stream: *mut ::FILE) -> ::c_int;
776     #[cfg_attr(
777         all(target_os = "macos", target_arch = "x86"),
778         link_name = "fdopen$UNIX2003"
779     )]
fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE780     pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
fileno(stream: *mut ::FILE) -> ::c_int781     pub fn fileno(stream: *mut ::FILE) -> ::c_int;
782 
783     #[cfg_attr(
784         all(target_os = "macos", target_arch = "x86"),
785         link_name = "open$UNIX2003"
786     )]
open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int787     pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
788     #[cfg_attr(
789         all(target_os = "macos", target_arch = "x86"),
790         link_name = "creat$UNIX2003"
791     )]
creat(path: *const c_char, mode: mode_t) -> ::c_int792     pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
793     #[cfg_attr(
794         all(target_os = "macos", target_arch = "x86"),
795         link_name = "fcntl$UNIX2003"
796     )]
fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int797     pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
798 
799     #[cfg_attr(
800         all(target_os = "macos", target_arch = "x86_64"),
801         link_name = "opendir$INODE64"
802     )]
803     #[cfg_attr(
804         all(target_os = "macos", target_arch = "x86"),
805         link_name = "opendir$INODE64$UNIX2003"
806     )]
807     #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
opendir(dirname: *const c_char) -> *mut ::DIR808     pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
809 
810     #[cfg_attr(
811         all(target_os = "macos", not(target_arch = "aarch64")),
812         link_name = "readdir$INODE64"
813     )]
814     #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
815     #[cfg_attr(
816         all(target_os = "freebsd", any(freebsd11, freebsd10)),
817         link_name = "readdir@FBSD_1.0"
818     )]
readdir(dirp: *mut ::DIR) -> *mut ::dirent819     pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
820     #[cfg_attr(
821         all(target_os = "macos", target_arch = "x86"),
822         link_name = "closedir$UNIX2003"
823     )]
closedir(dirp: *mut ::DIR) -> ::c_int824     pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
825     #[cfg_attr(
826         all(target_os = "macos", target_arch = "x86_64"),
827         link_name = "rewinddir$INODE64"
828     )]
829     #[cfg_attr(
830         all(target_os = "macos", target_arch = "x86"),
831         link_name = "rewinddir$INODE64$UNIX2003"
832     )]
rewinddir(dirp: *mut ::DIR)833     pub fn rewinddir(dirp: *mut ::DIR);
834 
fchmodat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, flags: ::c_int, ) -> ::c_int835     pub fn fchmodat(
836         dirfd: ::c_int,
837         pathname: *const ::c_char,
838         mode: ::mode_t,
839         flags: ::c_int,
840     ) -> ::c_int;
fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int841     pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int;
fchownat( dirfd: ::c_int, pathname: *const ::c_char, owner: ::uid_t, group: ::gid_t, flags: ::c_int, ) -> ::c_int842     pub fn fchownat(
843         dirfd: ::c_int,
844         pathname: *const ::c_char,
845         owner: ::uid_t,
846         group: ::gid_t,
847         flags: ::c_int,
848     ) -> ::c_int;
849     #[cfg_attr(
850         all(target_os = "macos", not(target_arch = "aarch64")),
851         link_name = "fstatat$INODE64"
852     )]
853     #[cfg_attr(
854         all(target_os = "freebsd", any(freebsd11, freebsd10)),
855         link_name = "fstatat@FBSD_1.1"
856     )]
fstatat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int, ) -> ::c_int857     pub fn fstatat(
858         dirfd: ::c_int,
859         pathname: *const ::c_char,
860         buf: *mut stat,
861         flags: ::c_int,
862     ) -> ::c_int;
linkat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int, ) -> ::c_int863     pub fn linkat(
864         olddirfd: ::c_int,
865         oldpath: *const ::c_char,
866         newdirfd: ::c_int,
867         newpath: *const ::c_char,
868         flags: ::c_int,
869     ) -> ::c_int;
renameat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, ) -> ::c_int870     pub fn renameat(
871         olddirfd: ::c_int,
872         oldpath: *const ::c_char,
873         newdirfd: ::c_int,
874         newpath: *const ::c_char,
875     ) -> ::c_int;
symlinkat( target: *const ::c_char, newdirfd: ::c_int, linkpath: *const ::c_char, ) -> ::c_int876     pub fn symlinkat(
877         target: *const ::c_char,
878         newdirfd: ::c_int,
879         linkpath: *const ::c_char,
880     ) -> ::c_int;
unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int881     pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int;
882 
access(path: *const c_char, amode: ::c_int) -> ::c_int883     pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
alarm(seconds: ::c_uint) -> ::c_uint884     pub fn alarm(seconds: ::c_uint) -> ::c_uint;
chdir(dir: *const c_char) -> ::c_int885     pub fn chdir(dir: *const c_char) -> ::c_int;
fchdir(dirfd: ::c_int) -> ::c_int886     pub fn fchdir(dirfd: ::c_int) -> ::c_int;
chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int887     pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
888     #[cfg_attr(
889         all(target_os = "macos", target_arch = "x86"),
890         link_name = "lchown$UNIX2003"
891     )]
lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int892     pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
893     #[cfg_attr(
894         all(target_os = "macos", target_arch = "x86"),
895         link_name = "close$NOCANCEL$UNIX2003"
896     )]
897     #[cfg_attr(
898         all(target_os = "macos", target_arch = "x86_64"),
899         link_name = "close$NOCANCEL"
900     )]
close(fd: ::c_int) -> ::c_int901     pub fn close(fd: ::c_int) -> ::c_int;
dup(fd: ::c_int) -> ::c_int902     pub fn dup(fd: ::c_int) -> ::c_int;
dup2(src: ::c_int, dst: ::c_int) -> ::c_int903     pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int904     pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int905     pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int906     pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int907     pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
execve( prog: *const c_char, argv: *const *const c_char, envp: *const *const c_char, ) -> ::c_int908     pub fn execve(
909         prog: *const c_char,
910         argv: *const *const c_char,
911         envp: *const *const c_char,
912     ) -> ::c_int;
execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int913     pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
fork() -> pid_t914     pub fn fork() -> pid_t;
fpathconf(filedes: ::c_int, name: ::c_int) -> c_long915     pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char916     pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
getegid() -> gid_t917     pub fn getegid() -> gid_t;
geteuid() -> uid_t918     pub fn geteuid() -> uid_t;
getgid() -> gid_t919     pub fn getgid() -> gid_t;
getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int920     pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
921     #[cfg_attr(target_os = "illumos", link_name = "getloginx")]
getlogin() -> *mut c_char922     pub fn getlogin() -> *mut c_char;
923     #[cfg_attr(
924         all(target_os = "macos", target_arch = "x86"),
925         link_name = "getopt$UNIX2003"
926     )]
getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int927     pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int;
getpgid(pid: pid_t) -> pid_t928     pub fn getpgid(pid: pid_t) -> pid_t;
getpgrp() -> pid_t929     pub fn getpgrp() -> pid_t;
getpid() -> pid_t930     pub fn getpid() -> pid_t;
getppid() -> pid_t931     pub fn getppid() -> pid_t;
getuid() -> uid_t932     pub fn getuid() -> uid_t;
isatty(fd: ::c_int) -> ::c_int933     pub fn isatty(fd: ::c_int) -> ::c_int;
link(src: *const c_char, dst: *const c_char) -> ::c_int934     pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t935     pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
pathconf(path: *const c_char, name: ::c_int) -> c_long936     pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
pipe(fds: *mut ::c_int) -> ::c_int937     pub fn pipe(fds: *mut ::c_int) -> ::c_int;
posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int938     pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int;
939     #[cfg_attr(
940         all(target_os = "macos", target_arch = "x86"),
941         link_name = "read$UNIX2003"
942     )]
read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t943     pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t;
rmdir(path: *const c_char) -> ::c_int944     pub fn rmdir(path: *const c_char) -> ::c_int;
seteuid(uid: uid_t) -> ::c_int945     pub fn seteuid(uid: uid_t) -> ::c_int;
setegid(gid: gid_t) -> ::c_int946     pub fn setegid(gid: gid_t) -> ::c_int;
setgid(gid: gid_t) -> ::c_int947     pub fn setgid(gid: gid_t) -> ::c_int;
setpgid(pid: pid_t, pgid: pid_t) -> ::c_int948     pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
setsid() -> pid_t949     pub fn setsid() -> pid_t;
setuid(uid: uid_t) -> ::c_int950     pub fn setuid(uid: uid_t) -> ::c_int;
setreuid(ruid: uid_t, euid: uid_t) -> ::c_int951     pub fn setreuid(ruid: uid_t, euid: uid_t) -> ::c_int;
setregid(rgid: gid_t, egid: gid_t) -> ::c_int952     pub fn setregid(rgid: gid_t, egid: gid_t) -> ::c_int;
953     #[cfg_attr(
954         all(target_os = "macos", target_arch = "x86"),
955         link_name = "sleep$UNIX2003"
956     )]
sleep(secs: ::c_uint) -> ::c_uint957     pub fn sleep(secs: ::c_uint) -> ::c_uint;
958     #[cfg_attr(
959         all(target_os = "macos", target_arch = "x86"),
960         link_name = "nanosleep$UNIX2003"
961     )]
962     #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int963     pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int;
tcgetpgrp(fd: ::c_int) -> pid_t964     pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int965     pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int;
ttyname(fd: ::c_int) -> *mut c_char966     pub fn ttyname(fd: ::c_int) -> *mut c_char;
967     #[cfg_attr(
968         all(target_os = "macos", target_arch = "x86"),
969         link_name = "ttyname_r$UNIX2003"
970     )]
971     #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int972     pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
unlink(c: *const c_char) -> ::c_int973     pub fn unlink(c: *const c_char) -> ::c_int;
974     #[cfg_attr(
975         all(target_os = "macos", target_arch = "x86"),
976         link_name = "wait$UNIX2003"
977     )]
wait(status: *mut ::c_int) -> pid_t978     pub fn wait(status: *mut ::c_int) -> pid_t;
979     #[cfg_attr(
980         all(target_os = "macos", target_arch = "x86"),
981         link_name = "waitpid$UNIX2003"
982     )]
waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t983     pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t;
984     #[cfg_attr(
985         all(target_os = "macos", target_arch = "x86"),
986         link_name = "write$UNIX2003"
987     )]
write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t988     pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t;
989     #[cfg_attr(
990         all(target_os = "macos", target_arch = "x86"),
991         link_name = "pread$UNIX2003"
992     )]
pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t993     pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
994     #[cfg_attr(
995         all(target_os = "macos", target_arch = "x86"),
996         link_name = "pwrite$UNIX2003"
997     )]
pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t998     pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
umask(mask: mode_t) -> mode_t999     pub fn umask(mask: mode_t) -> mode_t;
1000 
1001     #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
utime(file: *const c_char, buf: *const utimbuf) -> ::c_int1002     pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
1003 
1004     #[cfg_attr(
1005         all(target_os = "macos", target_arch = "x86"),
1006         link_name = "kill$UNIX2003"
1007     )]
kill(pid: pid_t, sig: ::c_int) -> ::c_int1008     pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
1009     #[cfg_attr(
1010         all(target_os = "macos", target_arch = "x86"),
1011         link_name = "killpg$UNIX2003"
1012     )]
killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int1013     pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int;
1014 
mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int1015     pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int1016     pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
mlockall(flags: ::c_int) -> ::c_int1017     pub fn mlockall(flags: ::c_int) -> ::c_int;
munlockall() -> ::c_int1018     pub fn munlockall() -> ::c_int;
1019 
1020     #[cfg_attr(
1021         all(target_os = "macos", target_arch = "x86"),
1022         link_name = "mmap$UNIX2003"
1023     )]
mmap( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t, ) -> *mut ::c_void1024     pub fn mmap(
1025         addr: *mut ::c_void,
1026         len: ::size_t,
1027         prot: ::c_int,
1028         flags: ::c_int,
1029         fd: ::c_int,
1030         offset: off_t,
1031     ) -> *mut ::c_void;
1032     #[cfg_attr(
1033         all(target_os = "macos", target_arch = "x86"),
1034         link_name = "munmap$UNIX2003"
1035     )]
munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int1036     pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
1037 
if_nametoindex(ifname: *const c_char) -> ::c_uint1038     pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char1039     pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char;
1040 
1041     #[cfg_attr(
1042         all(target_os = "macos", not(target_arch = "aarch64")),
1043         link_name = "lstat$INODE64"
1044     )]
1045     #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
1046     #[cfg_attr(
1047         all(target_os = "freebsd", any(freebsd11, freebsd10)),
1048         link_name = "lstat@FBSD_1.0"
1049     )]
lstat(path: *const c_char, buf: *mut stat) -> ::c_int1050     pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
1051 
1052     #[cfg_attr(
1053         all(target_os = "macos", target_arch = "x86"),
1054         link_name = "fsync$UNIX2003"
1055     )]
fsync(fd: ::c_int) -> ::c_int1056     pub fn fsync(fd: ::c_int) -> ::c_int;
1057 
1058     #[cfg_attr(
1059         all(target_os = "macos", target_arch = "x86"),
1060         link_name = "setenv$UNIX2003"
1061     )]
setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int1062     pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int;
1063     #[cfg_attr(
1064         all(target_os = "macos", target_arch = "x86"),
1065         link_name = "unsetenv$UNIX2003"
1066     )]
1067     #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
unsetenv(name: *const c_char) -> ::c_int1068     pub fn unsetenv(name: *const c_char) -> ::c_int;
1069 
symlink(path1: *const c_char, path2: *const c_char) -> ::c_int1070     pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int;
1071 
truncate(path: *const c_char, length: off_t) -> ::c_int1072     pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
ftruncate(fd: ::c_int, length: off_t) -> ::c_int1073     pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
1074 
signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t1075     pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
1076 
1077     #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int1078     pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
1079 
1080     #[cfg_attr(
1081         any(
1082             target_os = "macos",
1083             target_os = "ios",
1084             target_os = "tvos",
1085             target_os = "watchos",
1086             target_os = "visionos"
1087         ),
1088         link_name = "realpath$DARWIN_EXTSN"
1089     )]
realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char1090     pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;
1091 
flock(fd: ::c_int, operation: ::c_int) -> ::c_int1092     pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1093 
1094     #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
times(buf: *mut ::tms) -> ::clock_t1095     pub fn times(buf: *mut ::tms) -> ::clock_t;
1096 
pthread_self() -> ::pthread_t1097     pub fn pthread_self() -> ::pthread_t;
pthread_equal(t1: ::pthread_t, t2: ::pthread_t) -> ::c_int1098     pub fn pthread_equal(t1: ::pthread_t, t2: ::pthread_t) -> ::c_int;
1099     #[cfg_attr(
1100         all(target_os = "macos", target_arch = "x86"),
1101         link_name = "pthread_join$UNIX2003"
1102     )]
pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int1103     pub fn pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int;
pthread_exit(value: *mut ::c_void) -> !1104     pub fn pthread_exit(value: *mut ::c_void) -> !;
pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int1105     pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int1106     pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_attr_getstacksize( attr: *const ::pthread_attr_t, stacksize: *mut ::size_t, ) -> ::c_int1107     pub fn pthread_attr_getstacksize(
1108         attr: *const ::pthread_attr_t,
1109         stacksize: *mut ::size_t,
1110     ) -> ::c_int;
pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stack_size: ::size_t) -> ::c_int1111     pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stack_size: ::size_t) -> ::c_int;
pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int1112     pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int;
pthread_detach(thread: ::pthread_t) -> ::c_int1113     pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
1114     #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
sched_yield() -> ::c_int1115     pub fn sched_yield() -> ::c_int;
pthread_key_create( key: *mut pthread_key_t, dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, ) -> ::c_int1116     pub fn pthread_key_create(
1117         key: *mut pthread_key_t,
1118         dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>,
1119     ) -> ::c_int;
pthread_key_delete(key: pthread_key_t) -> ::c_int1120     pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int;
pthread_getspecific(key: pthread_key_t) -> *mut ::c_void1121     pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int1122     pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int;
pthread_mutex_init( lock: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t, ) -> ::c_int1123     pub fn pthread_mutex_init(
1124         lock: *mut pthread_mutex_t,
1125         attr: *const pthread_mutexattr_t,
1126     ) -> ::c_int;
pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int1127     pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int1128     pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int1129     pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int1130     pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
1131 
pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int1132     pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
1133     #[cfg_attr(
1134         all(target_os = "macos", target_arch = "x86"),
1135         link_name = "pthread_mutexattr_destroy$UNIX2003"
1136     )]
pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int1137     pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int1138     pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int;
1139 
1140     #[cfg_attr(
1141         all(target_os = "macos", target_arch = "x86"),
1142         link_name = "pthread_cond_init$UNIX2003"
1143     )]
pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> ::c_int1144     pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t)
1145         -> ::c_int;
1146     #[cfg_attr(
1147         all(target_os = "macos", target_arch = "x86"),
1148         link_name = "pthread_cond_wait$UNIX2003"
1149     )]
pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int1150     pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int;
1151     #[cfg_attr(
1152         all(target_os = "macos", target_arch = "x86"),
1153         link_name = "pthread_cond_timedwait$UNIX2003"
1154     )]
pthread_cond_timedwait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1155     pub fn pthread_cond_timedwait(
1156         cond: *mut pthread_cond_t,
1157         lock: *mut pthread_mutex_t,
1158         abstime: *const ::timespec,
1159     ) -> ::c_int;
pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int1160     pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int1161     pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int1162     pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int1163     pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int1164     pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
1165     #[cfg_attr(
1166         all(target_os = "macos", target_arch = "x86"),
1167         link_name = "pthread_rwlock_init$UNIX2003"
1168     )]
pthread_rwlock_init( lock: *mut pthread_rwlock_t, attr: *const pthread_rwlockattr_t, ) -> ::c_int1169     pub fn pthread_rwlock_init(
1170         lock: *mut pthread_rwlock_t,
1171         attr: *const pthread_rwlockattr_t,
1172     ) -> ::c_int;
1173     #[cfg_attr(
1174         all(target_os = "macos", target_arch = "x86"),
1175         link_name = "pthread_rwlock_destroy$UNIX2003"
1176     )]
pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int1177     pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
1178     #[cfg_attr(
1179         all(target_os = "macos", target_arch = "x86"),
1180         link_name = "pthread_rwlock_rdlock$UNIX2003"
1181     )]
pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int1182     pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1183     #[cfg_attr(
1184         all(target_os = "macos", target_arch = "x86"),
1185         link_name = "pthread_rwlock_tryrdlock$UNIX2003"
1186     )]
pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int1187     pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1188     #[cfg_attr(
1189         all(target_os = "macos", target_arch = "x86"),
1190         link_name = "pthread_rwlock_wrlock$UNIX2003"
1191     )]
pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int1192     pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1193     #[cfg_attr(
1194         all(target_os = "macos", target_arch = "x86"),
1195         link_name = "pthread_rwlock_trywrlock$UNIX2003"
1196     )]
pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int1197     pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1198     #[cfg_attr(
1199         all(target_os = "macos", target_arch = "x86"),
1200         link_name = "pthread_rwlock_unlock$UNIX2003"
1201     )]
pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int1202     pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int1203     pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int1204     pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int;
1205 
1206     #[cfg_attr(
1207         any(target_os = "illumos", target_os = "solaris"),
1208         link_name = "__xnet_getsockopt"
1209     )]
1210     #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")]
getsockopt( sockfd: ::c_int, level: ::c_int, optname: ::c_int, optval: *mut ::c_void, optlen: *mut ::socklen_t, ) -> ::c_int1211     pub fn getsockopt(
1212         sockfd: ::c_int,
1213         level: ::c_int,
1214         optname: ::c_int,
1215         optval: *mut ::c_void,
1216         optlen: *mut ::socklen_t,
1217     ) -> ::c_int;
raise(signum: ::c_int) -> ::c_int1218     pub fn raise(signum: ::c_int) -> ::c_int;
1219 
1220     #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int1221     pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int;
dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void1222     pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
dlerror() -> *mut ::c_char1223     pub fn dlerror() -> *mut ::c_char;
dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void1224     pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void;
dlclose(handle: *mut ::c_void) -> ::c_int1225     pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
1226 
1227     #[cfg(not(all(
1228         libc_cfg_target_vendor,
1229         target_arch = "powerpc",
1230         target_vendor = "nintendo"
1231     )))]
1232     #[cfg_attr(
1233         any(target_os = "illumos", target_os = "solaris"),
1234         link_name = "__xnet_getaddrinfo"
1235     )]
1236     #[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")]
getaddrinfo( node: *const c_char, service: *const c_char, hints: *const addrinfo, res: *mut *mut addrinfo, ) -> ::c_int1237     pub fn getaddrinfo(
1238         node: *const c_char,
1239         service: *const c_char,
1240         hints: *const addrinfo,
1241         res: *mut *mut addrinfo,
1242     ) -> ::c_int;
1243     #[cfg(not(all(
1244         libc_cfg_target_vendor,
1245         target_arch = "powerpc",
1246         target_vendor = "nintendo"
1247     )))]
1248     #[cfg_attr(target_os = "espidf", link_name = "lwip_freeaddrinfo")]
freeaddrinfo(res: *mut addrinfo)1249     pub fn freeaddrinfo(res: *mut addrinfo);
hstrerror(errcode: ::c_int) -> *const ::c_char1250     pub fn hstrerror(errcode: ::c_int) -> *const ::c_char;
gai_strerror(errcode: ::c_int) -> *const ::c_char1251     pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
1252     #[cfg_attr(
1253         any(
1254             all(
1255                 target_os = "linux",
1256                 not(any(target_env = "musl", target_env = "ohos"))
1257             ),
1258             target_os = "freebsd",
1259             target_os = "dragonfly",
1260             target_os = "haiku"
1261         ),
1262         link_name = "__res_init"
1263     )]
1264     #[cfg_attr(
1265         any(
1266             target_os = "macos",
1267             target_os = "ios",
1268             target_os = "tvos",
1269             target_os = "watchos",
1270             target_os = "visionos"
1271         ),
1272         link_name = "res_9_init"
1273     )]
res_init() -> ::c_int1274     pub fn res_init() -> ::c_int;
1275 
1276     #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
1277     #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1278     // FIXME: for `time_t`
gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1279     pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1280     #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
1281     #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1282     // FIXME: for `time_t`
localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1283     pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1284     #[cfg_attr(
1285         all(target_os = "macos", target_arch = "x86"),
1286         link_name = "mktime$UNIX2003"
1287     )]
1288     #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
1289     #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1290     // FIXME: for `time_t`
mktime(tm: *mut tm) -> time_t1291     pub fn mktime(tm: *mut tm) -> time_t;
1292     #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
1293     #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1294     // FIXME: for `time_t`
time(time: *mut time_t) -> time_t1295     pub fn time(time: *mut time_t) -> time_t;
1296     #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
1297     #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1298     // FIXME: for `time_t`
gmtime(time_p: *const time_t) -> *mut tm1299     pub fn gmtime(time_p: *const time_t) -> *mut tm;
1300     #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
1301     #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1302     // FIXME: for `time_t`
localtime(time_p: *const time_t) -> *mut tm1303     pub fn localtime(time_p: *const time_t) -> *mut tm;
1304     #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
1305     #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1306     // FIXME: for `time_t`
difftime(time1: time_t, time0: time_t) -> ::c_double1307     pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
1308     #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
1309     #[cfg_attr(any(target_env = "musl", target_env = "ohos"), allow(deprecated))]
1310     // FIXME: for `time_t`
timegm(tm: *mut ::tm) -> time_t1311     pub fn timegm(tm: *mut ::tm) -> time_t;
1312 
1313     #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
1314     #[cfg_attr(
1315         all(target_os = "freebsd", any(freebsd11, freebsd10)),
1316         link_name = "mknod@FBSD_1.0"
1317     )]
mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int1318     pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int;
gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1319     pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
endservent()1320     pub fn endservent();
getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent1321     pub fn getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent;
getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent1322     pub fn getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent;
getservent() -> *mut servent1323     pub fn getservent() -> *mut servent;
setservent(stayopen: ::c_int)1324     pub fn setservent(stayopen: ::c_int);
getprotobyname(name: *const ::c_char) -> *mut protoent1325     pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
getprotobynumber(proto: ::c_int) -> *mut protoent1326     pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
chroot(name: *const ::c_char) -> ::c_int1327     pub fn chroot(name: *const ::c_char) -> ::c_int;
1328     #[cfg_attr(
1329         all(target_os = "macos", target_arch = "x86"),
1330         link_name = "usleep$UNIX2003"
1331     )]
usleep(secs: ::c_uint) -> ::c_int1332     pub fn usleep(secs: ::c_uint) -> ::c_int;
1333     #[cfg_attr(
1334         all(target_os = "macos", target_arch = "x86"),
1335         link_name = "send$UNIX2003"
1336     )]
1337     #[cfg_attr(target_os = "espidf", link_name = "lwip_send")]
send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1338     pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
1339     #[cfg_attr(
1340         all(target_os = "macos", target_arch = "x86"),
1341         link_name = "recv$UNIX2003"
1342     )]
1343     #[cfg_attr(target_os = "espidf", link_name = "lwip_recv")]
recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1344     pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
1345     #[cfg_attr(
1346         all(target_os = "macos", target_arch = "x86"),
1347         link_name = "putenv$UNIX2003"
1348     )]
1349     #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
putenv(string: *mut c_char) -> ::c_int1350     pub fn putenv(string: *mut c_char) -> ::c_int;
1351     #[cfg_attr(
1352         all(target_os = "macos", target_arch = "x86"),
1353         link_name = "poll$UNIX2003"
1354     )]
poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1355     pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
1356     #[cfg_attr(
1357         all(target_os = "macos", target_arch = "x86_64"),
1358         link_name = "select$1050"
1359     )]
1360     #[cfg_attr(
1361         all(target_os = "macos", target_arch = "x86"),
1362         link_name = "select$UNIX2003"
1363     )]
1364     #[cfg_attr(target_os = "netbsd", link_name = "__select50")]
select( nfds: ::c_int, readfds: *mut fd_set, writefds: *mut fd_set, errorfds: *mut fd_set, timeout: *mut timeval, ) -> ::c_int1365     pub fn select(
1366         nfds: ::c_int,
1367         readfds: *mut fd_set,
1368         writefds: *mut fd_set,
1369         errorfds: *mut fd_set,
1370         timeout: *mut timeval,
1371     ) -> ::c_int;
1372     #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char1373     pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char;
localeconv() -> *mut lconv1374     pub fn localeconv() -> *mut lconv;
1375 
1376     #[cfg_attr(
1377         all(target_os = "macos", target_arch = "x86"),
1378         link_name = "sem_wait$UNIX2003"
1379     )]
sem_wait(sem: *mut sem_t) -> ::c_int1380     pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
sem_trywait(sem: *mut sem_t) -> ::c_int1381     pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
sem_post(sem: *mut sem_t) -> ::c_int1382     pub fn sem_post(sem: *mut sem_t) -> ::c_int;
statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int1383     pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int1384     pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
1385 
1386     #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
sigemptyset(set: *mut sigset_t) -> ::c_int1387     pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
1388     #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1389     pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1390     #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
sigfillset(set: *mut sigset_t) -> ::c_int1391     pub fn sigfillset(set: *mut sigset_t) -> ::c_int;
1392     #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1393     pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1394     #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int1395     pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
1396 
1397     #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1398     pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
1399     #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
sigpending(set: *mut sigset_t) -> ::c_int1400     pub fn sigpending(set: *mut sigset_t) -> ::c_int;
1401 
sysconf(name: ::c_int) -> ::c_long1402     pub fn sysconf(name: ::c_int) -> ::c_long;
1403 
mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1404     pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
1405 
fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int1406     pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int;
ftello(stream: *mut ::FILE) -> ::off_t1407     pub fn ftello(stream: *mut ::FILE) -> ::off_t;
1408     #[cfg_attr(
1409         all(target_os = "macos", target_arch = "x86"),
1410         link_name = "tcdrain$UNIX2003"
1411     )]
tcdrain(fd: ::c_int) -> ::c_int1412     pub fn tcdrain(fd: ::c_int) -> ::c_int;
cfgetispeed(termios: *const ::termios) -> ::speed_t1413     pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
cfgetospeed(termios: *const ::termios) -> ::speed_t1414     pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t;
cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1415     pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1416     pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int1417     pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int1418     pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int;
tcflow(fd: ::c_int, action: ::c_int) -> ::c_int1419     pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
tcflush(fd: ::c_int, action: ::c_int) -> ::c_int1420     pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
tcgetsid(fd: ::c_int) -> ::pid_t1421     pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int1422     pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
mkstemp(template: *mut ::c_char) -> ::c_int1423     pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
mkdtemp(template: *mut ::c_char) -> *mut ::c_char1424     pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
1425 
tmpnam(ptr: *mut ::c_char) -> *mut ::c_char1426     pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
1427 
openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int)1428     pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
closelog()1429     pub fn closelog();
setlogmask(maskpri: ::c_int) -> ::c_int1430     pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
1431     #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
syslog(priority: ::c_int, message: *const ::c_char, ...)1432     pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
1433     #[cfg_attr(
1434         all(target_os = "macos", target_arch = "x86"),
1435         link_name = "nice$UNIX2003"
1436     )]
nice(incr: ::c_int) -> ::c_int1437     pub fn nice(incr: ::c_int) -> ::c_int;
1438 
grantpt(fd: ::c_int) -> ::c_int1439     pub fn grantpt(fd: ::c_int) -> ::c_int;
posix_openpt(flags: ::c_int) -> ::c_int1440     pub fn posix_openpt(flags: ::c_int) -> ::c_int;
ptsname(fd: ::c_int) -> *mut ::c_char1441     pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
unlockpt(fd: ::c_int) -> ::c_int1442     pub fn unlockpt(fd: ::c_int) -> ::c_int;
1443 
strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char1444     pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t1445     pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
1446 
lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int1447     pub fn lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int;
1448 
1449 }
1450 
1451 cfg_if! {
1452     if #[cfg(not(any(target_os = "emscripten",
1453                      target_os = "android",
1454                      target_os = "haiku",
1455                      target_os = "nto")))] {
1456         extern "C" {
1457             pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int;
1458         }
1459     }
1460 }
1461 
1462 cfg_if! {
1463     if #[cfg(not(any(target_os = "emscripten",
1464                      target_os = "android",
1465                      target_os = "nto")))] {
1466         extern "C" {
1467             pub fn stpncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
1468         }
1469     }
1470 }
1471 
1472 cfg_if! {
1473     if #[cfg(not(target_os = "aix"))] {
1474         extern "C" {
1475             pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
1476         }
1477     }
1478 }
1479 
1480 cfg_if! {
1481     if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] {
1482         extern "C" {
1483             pub fn open_wmemstream(
1484                 ptr: *mut *mut wchar_t,
1485                 sizeloc: *mut size_t,
1486             ) -> *mut FILE;
1487         }
1488     }
1489 }
1490 
1491 cfg_if! {
1492     if #[cfg(not(target_os = "redox"))] {
1493         extern {
1494             pub fn getsid(pid: pid_t) -> pid_t;
1495             #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1496                        link_name = "pause$UNIX2003")]
1497             pub fn pause() -> ::c_int;
1498 
1499             pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
1500                           mode: ::mode_t) -> ::c_int;
1501             pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
1502                           flags: ::c_int, ...) -> ::c_int;
1503 
1504             #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1505                        link_name = "fdopendir$INODE64")]
1506             #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1507                        link_name = "fdopendir$INODE64$UNIX2003")]
1508             pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
1509 
1510             #[cfg_attr(all(target_os = "macos", not(target_arch = "aarch64")),
1511                        link_name = "readdir_r$INODE64")]
1512             #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
1513             #[cfg_attr(
1514                 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1515                 link_name = "readdir_r@FBSD_1.0"
1516             )]
1517             #[allow(non_autolinks)] // FIXME: `<>` breaks line length limit.
1518             /// The 64-bit libc on Solaris and illumos only has readdir_r. If a
1519             /// 32-bit Solaris or illumos target is ever created, it should use
1520             /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos:
1521             /// https://illumos.org/man/3lib/libc
1522             /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html
1523             /// https://www.unix.com/man-page/opensolaris/3LIB/libc/
1524             pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
1525                              result: *mut *mut ::dirent) -> ::c_int;
1526         }
1527     }
1528 }
1529 
1530 cfg_if! {
1531     if #[cfg(target_os = "nto")] {
1532         extern {
1533             pub fn readlinkat(dirfd: ::c_int,
1534                 pathname: *const ::c_char,
1535                 buf: *mut ::c_char,
1536                 bufsiz: ::size_t) -> ::c_int;
1537             pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::c_int;
1538             pub fn pselect(
1539                 nfds: ::c_int,
1540                 readfds: *mut fd_set,
1541                 writefds: *mut fd_set,
1542                 errorfds: *mut fd_set,
1543                 timeout: *mut timespec,
1544                 sigmask: *const sigset_t,
1545             ) -> ::c_int;
1546             pub fn sigaction(
1547                 signum: ::c_int,
1548                 act: *const sigaction,
1549                 oldact: *mut sigaction
1550             ) -> ::c_int;
1551         }
1552     } else {
1553         extern {
1554             pub fn readlinkat(dirfd: ::c_int,
1555                 pathname: *const ::c_char,
1556                 buf: *mut ::c_char,
1557                 bufsiz: ::size_t) -> ::ssize_t;
1558             pub fn fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE;
1559             pub fn open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE;
1560             pub fn atexit(cb: extern "C" fn()) -> c_int;
1561             #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
1562             pub fn sigaction(
1563                 signum: ::c_int,
1564                 act: *const sigaction,
1565                 oldact: *mut sigaction
1566             ) -> ::c_int;
1567             pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t;
1568             #[cfg_attr(
1569                 all(target_os = "macos", target_arch = "x86_64"),
1570                 link_name = "pselect$1050"
1571             )]
1572             #[cfg_attr(
1573                 all(target_os = "macos", target_arch = "x86"),
1574                 link_name = "pselect$UNIX2003"
1575             )]
1576             #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
1577             pub fn pselect(
1578                 nfds: ::c_int,
1579                 readfds: *mut fd_set,
1580                 writefds: *mut fd_set,
1581                 errorfds: *mut fd_set,
1582                 timeout: *const timespec,
1583                 sigmask: *const sigset_t,
1584             ) -> ::c_int;
1585         }
1586     }
1587 }
1588 
1589 cfg_if! {
1590    if #[cfg(not(any(target_os = "solaris",
1591                     target_os = "illumos",
1592                     target_os = "nto",
1593                 )))] {
1594         extern {
1595             pub fn cfmakeraw(termios: *mut ::termios);
1596             pub fn cfsetspeed(termios: *mut ::termios,
1597                               speed: ::speed_t) -> ::c_int;
1598         }
1599    }
1600 }
1601 
1602 extern "C" {
fnmatch(pattern: *const c_char, name: *const c_char, flags: c_int) -> c_int1603     pub fn fnmatch(pattern: *const c_char, name: *const c_char, flags: c_int) -> c_int;
1604 }
1605 
1606 cfg_if! {
1607     if #[cfg(target_env = "newlib")] {
1608         mod newlib;
1609         pub use self::newlib::*;
1610     } else if #[cfg(any(target_os = "linux",
1611                         target_os = "l4re",
1612                         target_os = "android",
1613                         target_os = "emscripten"))] {
1614         mod linux_like;
1615         pub use self::linux_like::*;
1616     } else if #[cfg(any(target_os = "macos",
1617                         target_os = "ios",
1618                         target_os = "tvos",
1619                         target_os = "watchos",
1620                         target_os = "visionos",
1621                         target_os = "freebsd",
1622                         target_os = "dragonfly",
1623                         target_os = "openbsd",
1624                         target_os = "netbsd"))] {
1625         mod bsd;
1626         pub use self::bsd::*;
1627     } else if #[cfg(any(target_os = "solaris",
1628                         target_os = "illumos"))] {
1629         mod solarish;
1630         pub use self::solarish::*;
1631     } else if #[cfg(target_os = "haiku")] {
1632         mod haiku;
1633         pub use self::haiku::*;
1634     } else if #[cfg(target_os = "redox")] {
1635         mod redox;
1636         pub use self::redox::*;
1637     } else if #[cfg(target_os = "nto")] {
1638         mod nto;
1639         pub use self::nto::*;
1640     } else if #[cfg(target_os = "aix")] {
1641         mod aix;
1642         pub use self::aix::*;
1643     } else if #[cfg(target_os = "hurd")] {
1644         mod hurd;
1645         pub use self::hurd::*;
1646     } else if #[cfg(target_os = "nuttx")] {
1647         mod nuttx;
1648         pub use self::nuttx::*;
1649     } else {
1650         // Unknown target_os
1651     }
1652 }
1653 
1654 cfg_if! {
1655     if #[cfg(libc_core_cvoid)] {
1656         pub use ::ffi::c_void;
1657     } else {
1658         // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
1659         // enable more optimization opportunities around it recognizing things
1660         // like malloc/free.
1661         #[repr(u8)]
1662         #[allow(missing_copy_implementations)]
1663         #[allow(missing_debug_implementations)]
1664         pub enum c_void {
1665             // Two dummy variants so the #[repr] attribute can be used.
1666             #[doc(hidden)]
1667             __variant1,
1668             #[doc(hidden)]
1669             __variant2,
1670         }
1671     }
1672 }
1673 
1674 cfg_if! {
1675     if #[cfg(libc_align)] {
1676         mod align;
1677         pub use self::align::*;
1678     } else {
1679         mod no_align;
1680         pub use self::no_align::*;
1681     }
1682 }
1683