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 uid_t = u32;
27 pub type gid_t = u32;
28 pub type in_addr_t = u32;
29 pub type in_port_t = u16;
30 pub type sighandler_t = ::size_t;
31 pub type cc_t = ::c_uchar;
32 
33 #[cfg_attr(feature = "extra_traits", derive(Debug))]
34 pub enum DIR {}
35 impl ::Copy for DIR {}
36 impl ::Clone for DIR {
clone(&self) -> DIR37     fn clone(&self) -> DIR {
38         *self
39     }
40 }
41 pub type locale_t = *mut ::c_void;
42 
43 s! {
44     pub struct group {
45         pub gr_name: *mut ::c_char,
46         pub gr_passwd: *mut ::c_char,
47         pub gr_gid: ::gid_t,
48         pub gr_mem: *mut *mut ::c_char,
49     }
50 
51     pub struct utimbuf {
52         pub actime: time_t,
53         pub modtime: time_t,
54     }
55 
56     pub struct timeval {
57         pub tv_sec: time_t,
58         pub tv_usec: suseconds_t,
59     }
60 
61     // linux x32 compatibility
62     // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
63     pub struct timespec {
64         pub tv_sec: time_t,
65         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
66         pub tv_nsec: i64,
67         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
68         pub tv_nsec: ::c_long,
69     }
70 
71     pub struct rlimit {
72         pub rlim_cur: rlim_t,
73         pub rlim_max: rlim_t,
74     }
75 
76     pub struct rusage {
77         pub ru_utime: timeval,
78         pub ru_stime: timeval,
79         pub ru_maxrss: c_long,
80         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
81         __pad1: u32,
82         pub ru_ixrss: c_long,
83         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
84         __pad2: u32,
85         pub ru_idrss: c_long,
86         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
87         __pad3: u32,
88         pub ru_isrss: c_long,
89         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
90         __pad4: u32,
91         pub ru_minflt: c_long,
92         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
93         __pad5: u32,
94         pub ru_majflt: c_long,
95         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
96         __pad6: u32,
97         pub ru_nswap: c_long,
98         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
99         __pad7: u32,
100         pub ru_inblock: c_long,
101         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
102         __pad8: u32,
103         pub ru_oublock: c_long,
104         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
105         __pad9: u32,
106         pub ru_msgsnd: c_long,
107         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
108         __pad10: u32,
109         pub ru_msgrcv: c_long,
110         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
111         __pad11: u32,
112         pub ru_nsignals: c_long,
113         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
114         __pad12: u32,
115         pub ru_nvcsw: c_long,
116         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
117         __pad13: u32,
118         pub ru_nivcsw: c_long,
119         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
120         __pad14: u32,
121 
122         #[cfg(any(target_env = "musl", target_os = "emscripten"))]
123         __reserved: [c_long; 16],
124     }
125 
126     pub struct ipv6_mreq {
127         pub ipv6mr_multiaddr: in6_addr,
128         #[cfg(target_os = "android")]
129         pub ipv6mr_interface: ::c_int,
130         #[cfg(not(target_os = "android"))]
131         pub ipv6mr_interface: ::c_uint,
132     }
133 
134     pub struct hostent {
135         pub h_name: *mut ::c_char,
136         pub h_aliases: *mut *mut ::c_char,
137         pub h_addrtype: ::c_int,
138         pub h_length: ::c_int,
139         pub h_addr_list: *mut *mut ::c_char,
140     }
141 
142     pub struct iovec {
143         pub iov_base: *mut ::c_void,
144         pub iov_len: ::size_t,
145     }
146 
147     pub struct pollfd {
148         pub fd: ::c_int,
149         pub events: ::c_short,
150         pub revents: ::c_short,
151     }
152 
153     pub struct winsize {
154         pub ws_row: ::c_ushort,
155         pub ws_col: ::c_ushort,
156         pub ws_xpixel: ::c_ushort,
157         pub ws_ypixel: ::c_ushort,
158     }
159 
160     pub struct linger {
161         pub l_onoff: ::c_int,
162         pub l_linger: ::c_int,
163     }
164 
165     pub struct sigval {
166         // Actually a union of an int and a void*
167         pub sival_ptr: *mut ::c_void
168     }
169 
170     // <sys/time.h>
171     pub struct itimerval {
172         pub it_interval: ::timeval,
173         pub it_value: ::timeval,
174     }
175 
176     // <sys/times.h>
177     pub struct tms {
178         pub tms_utime: ::clock_t,
179         pub tms_stime: ::clock_t,
180         pub tms_cutime: ::clock_t,
181         pub tms_cstime: ::clock_t,
182     }
183 
184     pub struct servent {
185         pub s_name: *mut ::c_char,
186         pub s_aliases: *mut *mut ::c_char,
187         pub s_port: ::c_int,
188         pub s_proto: *mut ::c_char,
189     }
190 
191     pub struct protoent {
192         pub p_name: *mut ::c_char,
193         pub p_aliases: *mut *mut ::c_char,
194         pub p_proto: ::c_int,
195     }
196 }
197 
198 pub const INT_MIN: c_int = -2147483648;
199 pub const INT_MAX: c_int = 2147483647;
200 
201 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
202 pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
203 pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
204 
205 pub const DT_UNKNOWN: u8 = 0;
206 pub const DT_FIFO: u8 = 1;
207 pub const DT_CHR: u8 = 2;
208 pub const DT_DIR: u8 = 4;
209 pub const DT_BLK: u8 = 6;
210 pub const DT_REG: u8 = 8;
211 pub const DT_LNK: u8 = 10;
212 pub const DT_SOCK: u8 = 12;
213 
214 cfg_if! {
215     if #[cfg(not(target_os = "redox"))] {
216         pub const FD_CLOEXEC: ::c_int = 0x1;
217     }
218 }
219 
220 pub const USRQUOTA: ::c_int = 0;
221 pub const GRPQUOTA: ::c_int = 1;
222 
223 pub const SIGIOT: ::c_int = 6;
224 
225 pub const S_ISUID: ::mode_t = 0x800;
226 pub const S_ISGID: ::mode_t = 0x400;
227 pub const S_ISVTX: ::mode_t = 0x200;
228 
229 pub const IF_NAMESIZE: ::size_t = 16;
230 pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
231 
232 pub const LOG_EMERG: ::c_int = 0;
233 pub const LOG_ALERT: ::c_int = 1;
234 pub const LOG_CRIT: ::c_int = 2;
235 pub const LOG_ERR: ::c_int = 3;
236 pub const LOG_WARNING: ::c_int = 4;
237 pub const LOG_NOTICE: ::c_int = 5;
238 pub const LOG_INFO: ::c_int = 6;
239 pub const LOG_DEBUG: ::c_int = 7;
240 
241 pub const LOG_KERN: ::c_int = 0;
242 pub const LOG_USER: ::c_int = 1 << 3;
243 pub const LOG_MAIL: ::c_int = 2 << 3;
244 pub const LOG_DAEMON: ::c_int = 3 << 3;
245 pub const LOG_AUTH: ::c_int = 4 << 3;
246 pub const LOG_SYSLOG: ::c_int = 5 << 3;
247 pub const LOG_LPR: ::c_int = 6 << 3;
248 pub const LOG_NEWS: ::c_int = 7 << 3;
249 pub const LOG_UUCP: ::c_int = 8 << 3;
250 pub const LOG_LOCAL0: ::c_int = 16 << 3;
251 pub const LOG_LOCAL1: ::c_int = 17 << 3;
252 pub const LOG_LOCAL2: ::c_int = 18 << 3;
253 pub const LOG_LOCAL3: ::c_int = 19 << 3;
254 pub const LOG_LOCAL4: ::c_int = 20 << 3;
255 pub const LOG_LOCAL5: ::c_int = 21 << 3;
256 pub const LOG_LOCAL6: ::c_int = 22 << 3;
257 pub const LOG_LOCAL7: ::c_int = 23 << 3;
258 
259 pub const LOG_PID: ::c_int = 0x01;
260 pub const LOG_CONS: ::c_int = 0x02;
261 pub const LOG_ODELAY: ::c_int = 0x04;
262 pub const LOG_NDELAY: ::c_int = 0x08;
263 pub const LOG_NOWAIT: ::c_int = 0x10;
264 
265 pub const LOG_PRIMASK: ::c_int = 7;
266 pub const LOG_FACMASK: ::c_int = 0x3f8;
267 
268 pub const PRIO_PROCESS: ::c_int = 0;
269 pub const PRIO_PGRP: ::c_int = 1;
270 pub const PRIO_USER: ::c_int = 2;
271 
272 pub const PRIO_MIN: ::c_int = -20;
273 pub const PRIO_MAX: ::c_int = 20;
274 
275 pub const IPPROTO_ICMP: ::c_int = 1;
276 pub const IPPROTO_ICMPV6: ::c_int = 58;
277 pub const IPPROTO_TCP: ::c_int = 6;
278 pub const IPPROTO_UDP: ::c_int = 17;
279 pub const IPPROTO_IP: ::c_int = 0;
280 pub const IPPROTO_IPV6: ::c_int = 41;
281 
282 pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
283 pub const INADDR_ANY: in_addr_t = 0;
284 pub const INADDR_BROADCAST: in_addr_t = 4294967295;
285 pub const INADDR_NONE: in_addr_t = 4294967295;
286 
287 pub const ARPOP_REQUEST: u16 = 1;
288 pub const ARPOP_REPLY: u16 = 2;
289 
290 pub const ATF_COM: ::c_int = 0x02;
291 pub const ATF_PERM: ::c_int = 0x04;
292 pub const ATF_PUBL: ::c_int = 0x08;
293 pub const ATF_USETRAILERS: ::c_int = 0x10;
294 
295 cfg_if! {
296     if #[cfg(target_os = "l4re")] {
297         // required libraries for L4Re are linked externally, ATM
298     } else if #[cfg(feature = "std")] {
299         // cargo build, don't pull in anything extra as the libstd dep
300         // already pulls in all libs.
301     } else if #[cfg(target_env = "musl")] {
302         #[cfg_attr(feature = "rustc-dep-of-std",
303                    link(name = "c", kind = "static",
304                         cfg(target_feature = "crt-static")))]
305         #[cfg_attr(feature = "rustc-dep-of-std",
306                    link(name = "c", cfg(not(target_feature = "crt-static"))))]
307         extern {}
308     } else if #[cfg(target_os = "emscripten")] {
309         #[link(name = "c")]
310         extern {}
311     } else if #[cfg(all(target_os = "netbsd",
312                         feature = "rustc-dep-of-std",
313                         target_vendor = "rumprun"))] {
314         // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
315         // in automatically by the linker. We avoid passing it explicitly, as it
316         // causes some versions of binutils to crash with an assertion failure.
317         #[link(name = "m")]
318         extern {}
319     } else if #[cfg(any(target_os = "macos",
320                         target_os = "ios",
321                         target_os = "android",
322                         target_os = "openbsd"))] {
323         #[link(name = "c")]
324         #[link(name = "m")]
325         extern {}
326     } else if #[cfg(target_os = "haiku")] {
327         #[link(name = "root")]
328         #[link(name = "network")]
329         extern {}
330     } else if #[cfg(target_env = "newlib")] {
331         #[link(name = "c")]
332         #[link(name = "m")]
333         extern {}
334     } else if #[cfg(target_os = "hermit")] {
335         // no_default_libraries is set to false for HermitCore, so only a link
336         // to "pthread" needs to be added.
337         #[link(name = "pthread")]
338         extern {}
339     } else if #[cfg(target_env = "illumos")] {
340         #[link(name = "c")]
341         #[link(name = "m")]
342         extern {}
343     } else if #[cfg(target_os = "redox")] {
344         #[cfg_attr(feature = "rustc-dep-of-std",
345                    link(name = "c", kind = "static-nobundle",
346                         cfg(target_feature = "crt-static")))]
347         #[cfg_attr(feature = "rustc-dep-of-std",
348                    link(name = "c", cfg(not(target_feature = "crt-static"))))]
349         extern {}
350     } else {
351         #[link(name = "c")]
352         #[link(name = "m")]
353         #[link(name = "rt")]
354         #[link(name = "pthread")]
355         extern {}
356     }
357 }
358 
359 #[cfg_attr(feature = "extra_traits", derive(Debug))]
360 pub enum FILE {}
361 impl ::Copy for FILE {}
362 impl ::Clone for FILE {
clone(&self) -> FILE363     fn clone(&self) -> FILE {
364         *self
365     }
366 }
367 #[cfg_attr(feature = "extra_traits", derive(Debug))]
368 pub enum fpos_t {} // FIXME: fill this out with a struct
369 impl ::Copy for fpos_t {}
370 impl ::Clone for fpos_t {
clone(&self) -> fpos_t371     fn clone(&self) -> fpos_t {
372         *self
373     }
374 }
375 
376 extern "C" {
isalnum(c: c_int) -> c_int377     pub fn isalnum(c: c_int) -> c_int;
isalpha(c: c_int) -> c_int378     pub fn isalpha(c: c_int) -> c_int;
iscntrl(c: c_int) -> c_int379     pub fn iscntrl(c: c_int) -> c_int;
isdigit(c: c_int) -> c_int380     pub fn isdigit(c: c_int) -> c_int;
isgraph(c: c_int) -> c_int381     pub fn isgraph(c: c_int) -> c_int;
islower(c: c_int) -> c_int382     pub fn islower(c: c_int) -> c_int;
isprint(c: c_int) -> c_int383     pub fn isprint(c: c_int) -> c_int;
ispunct(c: c_int) -> c_int384     pub fn ispunct(c: c_int) -> c_int;
isspace(c: c_int) -> c_int385     pub fn isspace(c: c_int) -> c_int;
isupper(c: c_int) -> c_int386     pub fn isupper(c: c_int) -> c_int;
isxdigit(c: c_int) -> c_int387     pub fn isxdigit(c: c_int) -> c_int;
isblank(c: c_int) -> c_int388     pub fn isblank(c: c_int) -> c_int;
tolower(c: c_int) -> c_int389     pub fn tolower(c: c_int) -> c_int;
toupper(c: c_int) -> c_int390     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, >, )391     pub fn qsort(
392         base: *mut c_void,
393         num: size_t,
394         size: size_t,
395         compar: ::Option<
396             unsafe extern "C" fn(*const c_void, *const c_void) -> c_int,
397         >,
398     );
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_void399     pub fn bsearch(
400         key: *const c_void,
401         base: *const c_void,
402         num: size_t,
403         size: size_t,
404         compar: ::Option<
405             unsafe extern "C" fn(*const c_void, *const c_void) -> c_int,
406         >,
407     ) -> *mut c_void;
408     #[cfg_attr(
409         all(target_os = "macos", target_arch = "x86"),
410         link_name = "fopen$UNIX2003"
411     )]
fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE412     pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
413     #[cfg_attr(
414         all(target_os = "macos", target_arch = "x86"),
415         link_name = "freopen$UNIX2003"
416     )]
freopen( filename: *const c_char, mode: *const c_char, file: *mut FILE, ) -> *mut FILE417     pub fn freopen(
418         filename: *const c_char,
419         mode: *const c_char,
420         file: *mut FILE,
421     ) -> *mut FILE;
fflush(file: *mut FILE) -> c_int422     pub fn fflush(file: *mut FILE) -> c_int;
fclose(file: *mut FILE) -> c_int423     pub fn fclose(file: *mut FILE) -> c_int;
remove(filename: *const c_char) -> c_int424     pub fn remove(filename: *const c_char) -> c_int;
rename(oldname: *const c_char, newname: *const c_char) -> c_int425     pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
tmpfile() -> *mut FILE426     pub fn tmpfile() -> *mut FILE;
setvbuf( stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t, ) -> c_int427     pub fn setvbuf(
428         stream: *mut FILE,
429         buffer: *mut c_char,
430         mode: c_int,
431         size: size_t,
432     ) -> c_int;
setbuf(stream: *mut FILE, buf: *mut c_char)433     pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
getchar() -> c_int434     pub fn getchar() -> c_int;
putchar(c: c_int) -> c_int435     pub fn putchar(c: c_int) -> c_int;
fgetc(stream: *mut FILE) -> c_int436     pub fn fgetc(stream: *mut FILE) -> c_int;
fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char437     pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
438         -> *mut c_char;
fputc(c: c_int, stream: *mut FILE) -> c_int439     pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
440     #[cfg_attr(
441         all(target_os = "macos", target_arch = "x86"),
442         link_name = "fputs$UNIX2003"
443     )]
fputs(s: *const c_char, stream: *mut FILE) -> c_int444     pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
puts(s: *const c_char) -> c_int445     pub fn puts(s: *const c_char) -> c_int;
ungetc(c: c_int, stream: *mut FILE) -> c_int446     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_t447     pub fn fread(
448         ptr: *mut c_void,
449         size: size_t,
450         nobj: size_t,
451         stream: *mut FILE,
452     ) -> size_t;
453     #[cfg_attr(
454         all(target_os = "macos", target_arch = "x86"),
455         link_name = "fwrite$UNIX2003"
456     )]
fwrite( ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE, ) -> size_t457     pub fn fwrite(
458         ptr: *const c_void,
459         size: size_t,
460         nobj: size_t,
461         stream: *mut FILE,
462     ) -> size_t;
fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int463     pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
ftell(stream: *mut FILE) -> c_long464     pub fn ftell(stream: *mut FILE) -> c_long;
rewind(stream: *mut FILE)465     pub fn rewind(stream: *mut FILE);
466     #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int467     pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
468     #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int469     pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
feof(stream: *mut FILE) -> c_int470     pub fn feof(stream: *mut FILE) -> c_int;
ferror(stream: *mut FILE) -> c_int471     pub fn ferror(stream: *mut FILE) -> c_int;
perror(s: *const c_char)472     pub fn perror(s: *const c_char);
atoi(s: *const c_char) -> c_int473     pub fn atoi(s: *const c_char) -> c_int;
474     #[cfg_attr(
475         all(target_os = "macos", target_arch = "x86"),
476         link_name = "strtod$UNIX2003"
477     )]
strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double478     pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
strtol( s: *const c_char, endp: *mut *mut c_char, base: c_int, ) -> c_long479     pub fn strtol(
480         s: *const c_char,
481         endp: *mut *mut c_char,
482         base: c_int,
483     ) -> c_long;
strtoul( s: *const c_char, endp: *mut *mut c_char, base: c_int, ) -> c_ulong484     pub fn strtoul(
485         s: *const c_char,
486         endp: *mut *mut c_char,
487         base: c_int,
488     ) -> c_ulong;
calloc(nobj: size_t, size: size_t) -> *mut c_void489     pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
malloc(size: size_t) -> *mut c_void490     pub fn malloc(size: size_t) -> *mut c_void;
realloc(p: *mut c_void, size: size_t) -> *mut c_void491     pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
free(p: *mut c_void)492     pub fn free(p: *mut c_void);
abort() -> !493     pub fn abort() -> !;
exit(status: c_int) -> !494     pub fn exit(status: c_int) -> !;
_exit(status: c_int) -> !495     pub fn _exit(status: c_int) -> !;
atexit(cb: extern "C" fn()) -> c_int496     pub fn atexit(cb: extern "C" fn()) -> c_int;
497     #[cfg_attr(
498         all(target_os = "macos", target_arch = "x86"),
499         link_name = "system$UNIX2003"
500     )]
system(s: *const c_char) -> c_int501     pub fn system(s: *const c_char) -> c_int;
getenv(s: *const c_char) -> *mut c_char502     pub fn getenv(s: *const c_char) -> *mut c_char;
503 
strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char504     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_char505     pub fn strncpy(
506         dst: *mut c_char,
507         src: *const c_char,
508         n: size_t,
509     ) -> *mut c_char;
strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char510     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_char511     pub fn strncat(
512         s: *mut c_char,
513         ct: *const c_char,
514         n: size_t,
515     ) -> *mut c_char;
strcmp(cs: *const c_char, ct: *const c_char) -> c_int516     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_int517     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_int518     pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
strchr(cs: *const c_char, c: c_int) -> *mut c_char519     pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
strrchr(cs: *const c_char, c: c_int) -> *mut c_char520     pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
strspn(cs: *const c_char, ct: *const c_char) -> size_t521     pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
strcspn(cs: *const c_char, ct: *const c_char) -> size_t522     pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
strdup(cs: *const c_char) -> *mut c_char523     pub fn strdup(cs: *const c_char) -> *mut c_char;
strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char524     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_char525     pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int526     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_int527     pub fn strncasecmp(
528         s1: *const c_char,
529         s2: *const c_char,
530         n: size_t,
531     ) -> c_int;
strlen(cs: *const c_char) -> size_t532     pub fn strlen(cs: *const c_char) -> size_t;
strnlen(cs: *const c_char, maxlen: size_t) -> size_t533     pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
534     #[cfg_attr(
535         all(target_os = "macos", target_arch = "x86"),
536         link_name = "strerror$UNIX2003"
537     )]
strerror(n: c_int) -> *mut c_char538     pub fn strerror(n: c_int) -> *mut c_char;
strtok(s: *mut c_char, t: *const c_char) -> *mut c_char539     pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t540     pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
wcslen(buf: *const wchar_t) -> size_t541     pub fn wcslen(buf: *const wchar_t) -> size_t;
wcstombs( dest: *mut c_char, src: *const wchar_t, n: size_t, ) -> ::size_t542     pub fn wcstombs(
543         dest: *mut c_char,
544         src: *const wchar_t,
545         n: size_t,
546     ) -> ::size_t;
547 
memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void548     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_t549     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_int550     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_void551     pub fn memcpy(
552         dest: *mut c_void,
553         src: *const c_void,
554         n: size_t,
555     ) -> *mut c_void;
memmove( dest: *mut c_void, src: *const c_void, n: size_t, ) -> *mut c_void556     pub fn memmove(
557         dest: *mut c_void,
558         src: *const c_void,
559         n: size_t,
560     ) -> *mut c_void;
memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void561     pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
562 }
563 
564 extern "C" {
565     #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
getpwnam(name: *const ::c_char) -> *mut passwd566     pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
567     #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
getpwuid(uid: ::uid_t) -> *mut passwd568     pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
569 
fprintf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int570     pub fn fprintf(
571         stream: *mut ::FILE,
572         format: *const ::c_char,
573         ...
574     ) -> ::c_int;
printf(format: *const ::c_char, ...) -> ::c_int575     pub fn printf(format: *const ::c_char, ...) -> ::c_int;
snprintf( s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ... ) -> ::c_int576     pub fn snprintf(
577         s: *mut ::c_char,
578         n: ::size_t,
579         format: *const ::c_char,
580         ...
581     ) -> ::c_int;
sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int582     pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
583     #[cfg_attr(target_os = "linux", link_name = "__isoc99_fscanf")]
fscanf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int584     pub fn fscanf(
585         stream: *mut ::FILE,
586         format: *const ::c_char,
587         ...
588     ) -> ::c_int;
589     #[cfg_attr(target_os = "linux", link_name = "__isoc99_scanf")]
scanf(format: *const ::c_char, ...) -> ::c_int590     pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
591     #[cfg_attr(target_os = "linux", link_name = "__isoc99_sscanf")]
sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int592     pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
593         -> ::c_int;
getchar_unlocked() -> ::c_int594     pub fn getchar_unlocked() -> ::c_int;
putchar_unlocked(c: ::c_int) -> ::c_int595     pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
596 
597     #[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
598     #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int599     pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
600     #[cfg_attr(
601         all(target_os = "macos", target_arch = "x86"),
602         link_name = "connect$UNIX2003"
603     )]
604     #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")]
connect( socket: ::c_int, address: *const sockaddr, len: socklen_t, ) -> ::c_int605     pub fn connect(
606         socket: ::c_int,
607         address: *const sockaddr,
608         len: socklen_t,
609     ) -> ::c_int;
610     #[cfg_attr(
611         all(target_os = "macos", target_arch = "x86"),
612         link_name = "listen$UNIX2003"
613     )]
614     #[cfg_attr(target_os = "illumos", link_name = "__xnet_listen")]
listen(socket: ::c_int, backlog: ::c_int) -> ::c_int615     pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
616     #[cfg_attr(
617         all(target_os = "macos", target_arch = "x86"),
618         link_name = "accept$UNIX2003"
619     )]
accept( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int620     pub fn accept(
621         socket: ::c_int,
622         address: *mut sockaddr,
623         address_len: *mut socklen_t,
624     ) -> ::c_int;
625     #[cfg_attr(
626         all(target_os = "macos", target_arch = "x86"),
627         link_name = "getpeername$UNIX2003"
628     )]
getpeername( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int629     pub fn getpeername(
630         socket: ::c_int,
631         address: *mut sockaddr,
632         address_len: *mut socklen_t,
633     ) -> ::c_int;
634     #[cfg_attr(
635         all(target_os = "macos", target_arch = "x86"),
636         link_name = "getsockname$UNIX2003"
637     )]
getsockname( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int638     pub fn getsockname(
639         socket: ::c_int,
640         address: *mut sockaddr,
641         address_len: *mut socklen_t,
642     ) -> ::c_int;
setsockopt( socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, option_len: socklen_t, ) -> ::c_int643     pub fn setsockopt(
644         socket: ::c_int,
645         level: ::c_int,
646         name: ::c_int,
647         value: *const ::c_void,
648         option_len: socklen_t,
649     ) -> ::c_int;
650     #[cfg_attr(
651         all(target_os = "macos", target_arch = "x86"),
652         link_name = "socketpair$UNIX2003"
653     )]
654     #[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")]
socketpair( domain: ::c_int, type_: ::c_int, protocol: ::c_int, socket_vector: *mut ::c_int, ) -> ::c_int655     pub fn socketpair(
656         domain: ::c_int,
657         type_: ::c_int,
658         protocol: ::c_int,
659         socket_vector: *mut ::c_int,
660     ) -> ::c_int;
661     #[cfg_attr(
662         all(target_os = "macos", target_arch = "x86"),
663         link_name = "sendto$UNIX2003"
664     )]
665     #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")]
sendto( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, addr: *const sockaddr, addrlen: socklen_t, ) -> ::ssize_t666     pub fn sendto(
667         socket: ::c_int,
668         buf: *const ::c_void,
669         len: ::size_t,
670         flags: ::c_int,
671         addr: *const sockaddr,
672         addrlen: socklen_t,
673     ) -> ::ssize_t;
shutdown(socket: ::c_int, how: ::c_int) -> ::c_int674     pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
675 
676     #[cfg_attr(
677         all(target_os = "macos", target_arch = "x86"),
678         link_name = "chmod$UNIX2003"
679     )]
chmod(path: *const c_char, mode: mode_t) -> ::c_int680     pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int;
681     #[cfg_attr(
682         all(target_os = "macos", target_arch = "x86"),
683         link_name = "fchmod$UNIX2003"
684     )]
fchmod(fd: ::c_int, mode: mode_t) -> ::c_int685     pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
686 
687     #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")]
688     #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
689     #[cfg_attr(
690         all(target_os = "freebsd", any(freebsd11, freebsd10)),
691         link_name = "fstat@FBSD_1.0"
692     )]
fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int693     pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
694 
mkdir(path: *const c_char, mode: mode_t) -> ::c_int695     pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
696 
697     #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
698     #[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
699     #[cfg_attr(
700         all(target_os = "freebsd", any(freebsd11, freebsd10)),
701         link_name = "stat@FBSD_1.0"
702     )]
stat(path: *const c_char, buf: *mut stat) -> ::c_int703     pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
704 
pclose(stream: *mut ::FILE) -> ::c_int705     pub fn pclose(stream: *mut ::FILE) -> ::c_int;
706     #[cfg_attr(
707         all(target_os = "macos", target_arch = "x86"),
708         link_name = "fdopen$UNIX2003"
709     )]
fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE710     pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
fileno(stream: *mut ::FILE) -> ::c_int711     pub fn fileno(stream: *mut ::FILE) -> ::c_int;
712 
713     #[cfg_attr(
714         all(target_os = "macos", target_arch = "x86"),
715         link_name = "open$UNIX2003"
716     )]
open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int717     pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
718     #[cfg_attr(
719         all(target_os = "macos", target_arch = "x86"),
720         link_name = "creat$UNIX2003"
721     )]
creat(path: *const c_char, mode: mode_t) -> ::c_int722     pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
723     #[cfg_attr(
724         all(target_os = "macos", target_arch = "x86"),
725         link_name = "fcntl$UNIX2003"
726     )]
fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int727     pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
728 
729     #[cfg_attr(
730         all(target_os = "macos", target_arch = "x86_64"),
731         link_name = "opendir$INODE64"
732     )]
733     #[cfg_attr(
734         all(target_os = "macos", target_arch = "x86"),
735         link_name = "opendir$INODE64$UNIX2003"
736     )]
737     #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
opendir(dirname: *const c_char) -> *mut ::DIR738     pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
739 
740     #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
741     #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
742     #[cfg_attr(
743         all(target_os = "freebsd", any(freebsd11, freebsd10)),
744         link_name = "readdir@FBSD_1.0"
745     )]
readdir(dirp: *mut ::DIR) -> *mut ::dirent746     pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
747     #[cfg_attr(
748         all(target_os = "macos", target_arch = "x86"),
749         link_name = "closedir$UNIX2003"
750     )]
closedir(dirp: *mut ::DIR) -> ::c_int751     pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
752     #[cfg_attr(
753         all(target_os = "macos", target_arch = "x86_64"),
754         link_name = "rewinddir$INODE64"
755     )]
756     #[cfg_attr(
757         all(target_os = "macos", target_arch = "x86"),
758         link_name = "rewinddir$INODE64$UNIX2003"
759     )]
rewinddir(dirp: *mut ::DIR)760     pub fn rewinddir(dirp: *mut ::DIR);
761 
fchmodat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, flags: ::c_int, ) -> ::c_int762     pub fn fchmodat(
763         dirfd: ::c_int,
764         pathname: *const ::c_char,
765         mode: ::mode_t,
766         flags: ::c_int,
767     ) -> ::c_int;
fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int768     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_int769     pub fn fchownat(
770         dirfd: ::c_int,
771         pathname: *const ::c_char,
772         owner: ::uid_t,
773         group: ::gid_t,
774         flags: ::c_int,
775     ) -> ::c_int;
776     #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
777     #[cfg_attr(
778         all(target_os = "freebsd", any(freebsd11, freebsd10)),
779         link_name = "fstatat@FBSD_1.1"
780     )]
fstatat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int, ) -> ::c_int781     pub fn fstatat(
782         dirfd: ::c_int,
783         pathname: *const ::c_char,
784         buf: *mut stat,
785         flags: ::c_int,
786     ) -> ::c_int;
linkat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int, ) -> ::c_int787     pub fn linkat(
788         olddirfd: ::c_int,
789         oldpath: *const ::c_char,
790         newdirfd: ::c_int,
791         newpath: *const ::c_char,
792         flags: ::c_int,
793     ) -> ::c_int;
renameat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, ) -> ::c_int794     pub fn renameat(
795         olddirfd: ::c_int,
796         oldpath: *const ::c_char,
797         newdirfd: ::c_int,
798         newpath: *const ::c_char,
799     ) -> ::c_int;
symlinkat( target: *const ::c_char, newdirfd: ::c_int, linkpath: *const ::c_char, ) -> ::c_int800     pub fn symlinkat(
801         target: *const ::c_char,
802         newdirfd: ::c_int,
803         linkpath: *const ::c_char,
804     ) -> ::c_int;
unlinkat( dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ) -> ::c_int805     pub fn unlinkat(
806         dirfd: ::c_int,
807         pathname: *const ::c_char,
808         flags: ::c_int,
809     ) -> ::c_int;
810 
access(path: *const c_char, amode: ::c_int) -> ::c_int811     pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
alarm(seconds: ::c_uint) -> ::c_uint812     pub fn alarm(seconds: ::c_uint) -> ::c_uint;
chdir(dir: *const c_char) -> ::c_int813     pub fn chdir(dir: *const c_char) -> ::c_int;
fchdir(dirfd: ::c_int) -> ::c_int814     pub fn fchdir(dirfd: ::c_int) -> ::c_int;
chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int815     pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
816     #[cfg_attr(
817         all(target_os = "macos", target_arch = "x86"),
818         link_name = "lchown$UNIX2003"
819     )]
lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int820     pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
821     #[cfg_attr(
822         all(target_os = "macos", target_arch = "x86"),
823         link_name = "close$NOCANCEL$UNIX2003"
824     )]
825     #[cfg_attr(
826         all(target_os = "macos", target_arch = "x86_64"),
827         link_name = "close$NOCANCEL"
828     )]
close(fd: ::c_int) -> ::c_int829     pub fn close(fd: ::c_int) -> ::c_int;
dup(fd: ::c_int) -> ::c_int830     pub fn dup(fd: ::c_int) -> ::c_int;
dup2(src: ::c_int, dst: ::c_int) -> ::c_int831     pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int832     pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
execle( path: *const ::c_char, arg0: *const ::c_char, ... ) -> ::c_int833     pub fn execle(
834         path: *const ::c_char,
835         arg0: *const ::c_char,
836         ...
837     ) -> ::c_int;
execlp( file: *const ::c_char, arg0: *const ::c_char, ... ) -> ::c_int838     pub fn execlp(
839         file: *const ::c_char,
840         arg0: *const ::c_char,
841         ...
842     ) -> ::c_int;
execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int843     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_int844     pub fn execve(
845         prog: *const c_char,
846         argv: *const *const c_char,
847         envp: *const *const c_char,
848     ) -> ::c_int;
execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int849     pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
fork() -> pid_t850     pub fn fork() -> pid_t;
fpathconf(filedes: ::c_int, name: ::c_int) -> c_long851     pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char852     pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
getegid() -> gid_t853     pub fn getegid() -> gid_t;
geteuid() -> uid_t854     pub fn geteuid() -> uid_t;
getgid() -> gid_t855     pub fn getgid() -> gid_t;
getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int856     pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
getlogin() -> *mut c_char857     pub fn getlogin() -> *mut c_char;
858     #[cfg_attr(
859         all(target_os = "macos", target_arch = "x86"),
860         link_name = "getopt$UNIX2003"
861     )]
getopt( argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char, ) -> ::c_int862     pub fn getopt(
863         argc: ::c_int,
864         argv: *const *mut c_char,
865         optstr: *const c_char,
866     ) -> ::c_int;
getpgid(pid: pid_t) -> pid_t867     pub fn getpgid(pid: pid_t) -> pid_t;
getpgrp() -> pid_t868     pub fn getpgrp() -> pid_t;
getpid() -> pid_t869     pub fn getpid() -> pid_t;
getppid() -> pid_t870     pub fn getppid() -> pid_t;
getuid() -> uid_t871     pub fn getuid() -> uid_t;
isatty(fd: ::c_int) -> ::c_int872     pub fn isatty(fd: ::c_int) -> ::c_int;
link(src: *const c_char, dst: *const c_char) -> ::c_int873     pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t874     pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
pathconf(path: *const c_char, name: ::c_int) -> c_long875     pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
pipe(fds: *mut ::c_int) -> ::c_int876     pub fn pipe(fds: *mut ::c_int) -> ::c_int;
posix_memalign( memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t, ) -> ::c_int877     pub fn posix_memalign(
878         memptr: *mut *mut ::c_void,
879         align: ::size_t,
880         size: ::size_t,
881     ) -> ::c_int;
882     #[cfg_attr(
883         all(target_os = "macos", target_arch = "x86"),
884         link_name = "read$UNIX2003"
885     )]
read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t886     pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
887         -> ::ssize_t;
rmdir(path: *const c_char) -> ::c_int888     pub fn rmdir(path: *const c_char) -> ::c_int;
seteuid(uid: uid_t) -> ::c_int889     pub fn seteuid(uid: uid_t) -> ::c_int;
setegid(gid: gid_t) -> ::c_int890     pub fn setegid(gid: gid_t) -> ::c_int;
setgid(gid: gid_t) -> ::c_int891     pub fn setgid(gid: gid_t) -> ::c_int;
setpgid(pid: pid_t, pgid: pid_t) -> ::c_int892     pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
setsid() -> pid_t893     pub fn setsid() -> pid_t;
setuid(uid: uid_t) -> ::c_int894     pub fn setuid(uid: uid_t) -> ::c_int;
895     #[cfg_attr(
896         all(target_os = "macos", target_arch = "x86"),
897         link_name = "sleep$UNIX2003"
898     )]
sleep(secs: ::c_uint) -> ::c_uint899     pub fn sleep(secs: ::c_uint) -> ::c_uint;
900     #[cfg_attr(
901         all(target_os = "macos", target_arch = "x86"),
902         link_name = "nanosleep$UNIX2003"
903     )]
904     #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int905     pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int;
tcgetpgrp(fd: ::c_int) -> pid_t906     pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int907     pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int;
ttyname(fd: ::c_int) -> *mut c_char908     pub fn ttyname(fd: ::c_int) -> *mut c_char;
909     #[cfg_attr(
910         all(target_os = "macos", target_arch = "x86"),
911         link_name = "ttyname_r$UNIX2003"
912     )]
ttyname_r( fd: ::c_int, buf: *mut c_char, buflen: ::size_t, ) -> ::c_int913     pub fn ttyname_r(
914         fd: ::c_int,
915         buf: *mut c_char,
916         buflen: ::size_t,
917     ) -> ::c_int;
unlink(c: *const c_char) -> ::c_int918     pub fn unlink(c: *const c_char) -> ::c_int;
919     #[cfg_attr(
920         all(target_os = "macos", target_arch = "x86"),
921         link_name = "wait$UNIX2003"
922     )]
wait(status: *mut ::c_int) -> pid_t923     pub fn wait(status: *mut ::c_int) -> pid_t;
924     #[cfg_attr(
925         all(target_os = "macos", target_arch = "x86"),
926         link_name = "waitpid$UNIX2003"
927     )]
waitpid( pid: pid_t, status: *mut ::c_int, options: ::c_int, ) -> pid_t928     pub fn waitpid(
929         pid: pid_t,
930         status: *mut ::c_int,
931         options: ::c_int,
932     ) -> pid_t;
933     #[cfg_attr(
934         all(target_os = "macos", target_arch = "x86"),
935         link_name = "write$UNIX2003"
936     )]
write( fd: ::c_int, buf: *const ::c_void, count: ::size_t, ) -> ::ssize_t937     pub fn write(
938         fd: ::c_int,
939         buf: *const ::c_void,
940         count: ::size_t,
941     ) -> ::ssize_t;
942     #[cfg_attr(
943         all(target_os = "macos", target_arch = "x86"),
944         link_name = "pread$UNIX2003"
945     )]
pread( fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t, ) -> ::ssize_t946     pub fn pread(
947         fd: ::c_int,
948         buf: *mut ::c_void,
949         count: ::size_t,
950         offset: off_t,
951     ) -> ::ssize_t;
952     #[cfg_attr(
953         all(target_os = "macos", target_arch = "x86"),
954         link_name = "pwrite$UNIX2003"
955     )]
pwrite( fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t, ) -> ::ssize_t956     pub fn pwrite(
957         fd: ::c_int,
958         buf: *const ::c_void,
959         count: ::size_t,
960         offset: off_t,
961     ) -> ::ssize_t;
umask(mask: mode_t) -> mode_t962     pub fn umask(mask: mode_t) -> mode_t;
963 
964     #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
utime(file: *const c_char, buf: *const utimbuf) -> ::c_int965     pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
966 
967     #[cfg_attr(
968         all(target_os = "macos", target_arch = "x86"),
969         link_name = "kill$UNIX2003"
970     )]
kill(pid: pid_t, sig: ::c_int) -> ::c_int971     pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
972     #[cfg_attr(
973         all(target_os = "macos", target_arch = "x86"),
974         link_name = "killpg$UNIX2003"
975     )]
killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int976     pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int;
977 
mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int978     pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int979     pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
mlockall(flags: ::c_int) -> ::c_int980     pub fn mlockall(flags: ::c_int) -> ::c_int;
munlockall() -> ::c_int981     pub fn munlockall() -> ::c_int;
982 
983     #[cfg_attr(
984         all(target_os = "macos", target_arch = "x86"),
985         link_name = "mmap$UNIX2003"
986     )]
mmap( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t, ) -> *mut ::c_void987     pub fn mmap(
988         addr: *mut ::c_void,
989         len: ::size_t,
990         prot: ::c_int,
991         flags: ::c_int,
992         fd: ::c_int,
993         offset: off_t,
994     ) -> *mut ::c_void;
995     #[cfg_attr(
996         all(target_os = "macos", target_arch = "x86"),
997         link_name = "munmap$UNIX2003"
998     )]
munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int999     pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
1000 
if_nametoindex(ifname: *const c_char) -> ::c_uint1001     pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
if_indextoname( ifindex: ::c_uint, ifname: *mut ::c_char, ) -> *mut ::c_char1002     pub fn if_indextoname(
1003         ifindex: ::c_uint,
1004         ifname: *mut ::c_char,
1005     ) -> *mut ::c_char;
1006 
1007     #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
1008     #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
1009     #[cfg_attr(
1010         all(target_os = "freebsd", any(freebsd11, freebsd10)),
1011         link_name = "lstat@FBSD_1.0"
1012     )]
lstat(path: *const c_char, buf: *mut stat) -> ::c_int1013     pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
1014 
1015     #[cfg_attr(
1016         all(target_os = "macos", target_arch = "x86"),
1017         link_name = "fsync$UNIX2003"
1018     )]
fsync(fd: ::c_int) -> ::c_int1019     pub fn fsync(fd: ::c_int) -> ::c_int;
1020 
1021     #[cfg_attr(
1022         all(target_os = "macos", target_arch = "x86"),
1023         link_name = "setenv$UNIX2003"
1024     )]
setenv( name: *const c_char, val: *const c_char, overwrite: ::c_int, ) -> ::c_int1025     pub fn setenv(
1026         name: *const c_char,
1027         val: *const c_char,
1028         overwrite: ::c_int,
1029     ) -> ::c_int;
1030     #[cfg_attr(
1031         all(target_os = "macos", target_arch = "x86"),
1032         link_name = "unsetenv$UNIX2003"
1033     )]
1034     #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
unsetenv(name: *const c_char) -> ::c_int1035     pub fn unsetenv(name: *const c_char) -> ::c_int;
1036 
symlink(path1: *const c_char, path2: *const c_char) -> ::c_int1037     pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int;
1038 
ftruncate(fd: ::c_int, length: off_t) -> ::c_int1039     pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
1040 
signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t1041     pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
1042 
1043     #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int1044     pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
1045 
1046     #[cfg_attr(
1047         any(target_os = "macos", target_os = "ios"),
1048         link_name = "realpath$DARWIN_EXTSN"
1049     )]
realpath( pathname: *const ::c_char, resolved: *mut ::c_char, ) -> *mut ::c_char1050     pub fn realpath(
1051         pathname: *const ::c_char,
1052         resolved: *mut ::c_char,
1053     ) -> *mut ::c_char;
1054 
flock(fd: ::c_int, operation: ::c_int) -> ::c_int1055     pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1056 
1057     #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
times(buf: *mut ::tms) -> ::clock_t1058     pub fn times(buf: *mut ::tms) -> ::clock_t;
1059 
pthread_self() -> ::pthread_t1060     pub fn pthread_self() -> ::pthread_t;
1061     #[cfg_attr(
1062         all(target_os = "macos", target_arch = "x86"),
1063         link_name = "pthread_join$UNIX2003"
1064     )]
pthread_join( native: ::pthread_t, value: *mut *mut ::c_void, ) -> ::c_int1065     pub fn pthread_join(
1066         native: ::pthread_t,
1067         value: *mut *mut ::c_void,
1068     ) -> ::c_int;
pthread_exit(value: *mut ::c_void) -> !1069     pub fn pthread_exit(value: *mut ::c_void) -> !;
pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int1070     pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int1071     pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_attr_setstacksize( attr: *mut ::pthread_attr_t, stack_size: ::size_t, ) -> ::c_int1072     pub fn pthread_attr_setstacksize(
1073         attr: *mut ::pthread_attr_t,
1074         stack_size: ::size_t,
1075     ) -> ::c_int;
pthread_attr_setdetachstate( attr: *mut ::pthread_attr_t, state: ::c_int, ) -> ::c_int1076     pub fn pthread_attr_setdetachstate(
1077         attr: *mut ::pthread_attr_t,
1078         state: ::c_int,
1079     ) -> ::c_int;
pthread_detach(thread: ::pthread_t) -> ::c_int1080     pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
1081     #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
sched_yield() -> ::c_int1082     pub fn sched_yield() -> ::c_int;
pthread_key_create( key: *mut pthread_key_t, dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, ) -> ::c_int1083     pub fn pthread_key_create(
1084         key: *mut pthread_key_t,
1085         dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>,
1086     ) -> ::c_int;
pthread_key_delete(key: pthread_key_t) -> ::c_int1087     pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int;
pthread_getspecific(key: pthread_key_t) -> *mut ::c_void1088     pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
pthread_setspecific( key: pthread_key_t, value: *const ::c_void, ) -> ::c_int1089     pub fn pthread_setspecific(
1090         key: pthread_key_t,
1091         value: *const ::c_void,
1092     ) -> ::c_int;
pthread_mutex_init( lock: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t, ) -> ::c_int1093     pub fn pthread_mutex_init(
1094         lock: *mut pthread_mutex_t,
1095         attr: *const pthread_mutexattr_t,
1096     ) -> ::c_int;
pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int1097     pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int1098     pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int1099     pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int1100     pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
1101 
pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int1102     pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
1103     #[cfg_attr(
1104         all(target_os = "macos", target_arch = "x86"),
1105         link_name = "pthread_mutexattr_destroy$UNIX2003"
1106     )]
pthread_mutexattr_destroy( attr: *mut pthread_mutexattr_t, ) -> ::c_int1107     pub fn pthread_mutexattr_destroy(
1108         attr: *mut pthread_mutexattr_t,
1109     ) -> ::c_int;
pthread_mutexattr_settype( attr: *mut pthread_mutexattr_t, _type: ::c_int, ) -> ::c_int1110     pub fn pthread_mutexattr_settype(
1111         attr: *mut pthread_mutexattr_t,
1112         _type: ::c_int,
1113     ) -> ::c_int;
1114 
1115     #[cfg_attr(
1116         all(target_os = "macos", target_arch = "x86"),
1117         link_name = "pthread_cond_init$UNIX2003"
1118     )]
pthread_cond_init( cond: *mut pthread_cond_t, attr: *const pthread_condattr_t, ) -> ::c_int1119     pub fn pthread_cond_init(
1120         cond: *mut pthread_cond_t,
1121         attr: *const pthread_condattr_t,
1122     ) -> ::c_int;
1123     #[cfg_attr(
1124         all(target_os = "macos", target_arch = "x86"),
1125         link_name = "pthread_cond_wait$UNIX2003"
1126     )]
pthread_cond_wait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, ) -> ::c_int1127     pub fn pthread_cond_wait(
1128         cond: *mut pthread_cond_t,
1129         lock: *mut pthread_mutex_t,
1130     ) -> ::c_int;
1131     #[cfg_attr(
1132         all(target_os = "macos", target_arch = "x86"),
1133         link_name = "pthread_cond_timedwait$UNIX2003"
1134     )]
pthread_cond_timedwait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1135     pub fn pthread_cond_timedwait(
1136         cond: *mut pthread_cond_t,
1137         lock: *mut pthread_mutex_t,
1138         abstime: *const ::timespec,
1139     ) -> ::c_int;
pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int1140     pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int1141     pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int1142     pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int1143     pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int1144     pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
1145     #[cfg_attr(
1146         all(target_os = "macos", target_arch = "x86"),
1147         link_name = "pthread_rwlock_init$UNIX2003"
1148     )]
pthread_rwlock_init( lock: *mut pthread_rwlock_t, attr: *const pthread_rwlockattr_t, ) -> ::c_int1149     pub fn pthread_rwlock_init(
1150         lock: *mut pthread_rwlock_t,
1151         attr: *const pthread_rwlockattr_t,
1152     ) -> ::c_int;
1153     #[cfg_attr(
1154         all(target_os = "macos", target_arch = "x86"),
1155         link_name = "pthread_rwlock_destroy$UNIX2003"
1156     )]
pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int1157     pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
1158     #[cfg_attr(
1159         all(target_os = "macos", target_arch = "x86"),
1160         link_name = "pthread_rwlock_rdlock$UNIX2003"
1161     )]
pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int1162     pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1163     #[cfg_attr(
1164         all(target_os = "macos", target_arch = "x86"),
1165         link_name = "pthread_rwlock_tryrdlock$UNIX2003"
1166     )]
pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int1167     pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1168     #[cfg_attr(
1169         all(target_os = "macos", target_arch = "x86"),
1170         link_name = "pthread_rwlock_wrlock$UNIX2003"
1171     )]
pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int1172     pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1173     #[cfg_attr(
1174         all(target_os = "macos", target_arch = "x86"),
1175         link_name = "pthread_rwlock_trywrlock$UNIX2003"
1176     )]
pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int1177     pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1178     #[cfg_attr(
1179         all(target_os = "macos", target_arch = "x86"),
1180         link_name = "pthread_rwlock_unlock$UNIX2003"
1181     )]
pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int1182     pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int1183     pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t)
1184         -> ::c_int;
pthread_rwlockattr_destroy( attr: *mut pthread_rwlockattr_t, ) -> ::c_int1185     pub fn pthread_rwlockattr_destroy(
1186         attr: *mut pthread_rwlockattr_t,
1187     ) -> ::c_int;
1188 
1189     #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")]
getsockopt( sockfd: ::c_int, level: ::c_int, optname: ::c_int, optval: *mut ::c_void, optlen: *mut ::socklen_t, ) -> ::c_int1190     pub fn getsockopt(
1191         sockfd: ::c_int,
1192         level: ::c_int,
1193         optname: ::c_int,
1194         optval: *mut ::c_void,
1195         optlen: *mut ::socklen_t,
1196     ) -> ::c_int;
raise(signum: ::c_int) -> ::c_int1197     pub fn raise(signum: ::c_int) -> ::c_int;
1198     #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
sigaction( signum: ::c_int, act: *const sigaction, oldact: *mut sigaction, ) -> ::c_int1199     pub fn sigaction(
1200         signum: ::c_int,
1201         act: *const sigaction,
1202         oldact: *mut sigaction,
1203     ) -> ::c_int;
1204 
1205     #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
utimes( filename: *const ::c_char, times: *const ::timeval, ) -> ::c_int1206     pub fn utimes(
1207         filename: *const ::c_char,
1208         times: *const ::timeval,
1209     ) -> ::c_int;
dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void1210     pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
dlerror() -> *mut ::c_char1211     pub fn dlerror() -> *mut ::c_char;
dlsym( handle: *mut ::c_void, symbol: *const ::c_char, ) -> *mut ::c_void1212     pub fn dlsym(
1213         handle: *mut ::c_void,
1214         symbol: *const ::c_char,
1215     ) -> *mut ::c_void;
dlclose(handle: *mut ::c_void) -> ::c_int1216     pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int1217     pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
1218 
getaddrinfo( node: *const c_char, service: *const c_char, hints: *const addrinfo, res: *mut *mut addrinfo, ) -> ::c_int1219     pub fn getaddrinfo(
1220         node: *const c_char,
1221         service: *const c_char,
1222         hints: *const addrinfo,
1223         res: *mut *mut addrinfo,
1224     ) -> ::c_int;
freeaddrinfo(res: *mut addrinfo)1225     pub fn freeaddrinfo(res: *mut addrinfo);
gai_strerror(errcode: ::c_int) -> *const ::c_char1226     pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
1227     #[cfg_attr(
1228         any(
1229             all(target_os = "linux", not(target_env = "musl")),
1230             target_os = "freebsd",
1231             target_os = "dragonfly",
1232             target_os = "haiku"
1233         ),
1234         link_name = "__res_init"
1235     )]
1236     #[cfg_attr(
1237         any(target_os = "macos", target_os = "ios"),
1238         link_name = "res_9_init"
1239     )]
res_init() -> ::c_int1240     pub fn res_init() -> ::c_int;
1241 
1242     #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1243     pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1244     #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1245     pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1246     #[cfg_attr(
1247         all(target_os = "macos", target_arch = "x86"),
1248         link_name = "mktime$UNIX2003"
1249     )]
1250     #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
mktime(tm: *mut tm) -> time_t1251     pub fn mktime(tm: *mut tm) -> time_t;
1252     #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
time(time: *mut time_t) -> time_t1253     pub fn time(time: *mut time_t) -> time_t;
1254     #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
gmtime(time_p: *const time_t) -> *mut tm1255     pub fn gmtime(time_p: *const time_t) -> *mut tm;
1256     #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
localtime(time_p: *const time_t) -> *mut tm1257     pub fn localtime(time_p: *const time_t) -> *mut tm;
1258     #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
difftime(time1: time_t, time0: time_t) -> ::c_double1259     pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
1260 
1261     #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
1262     #[cfg_attr(
1263         all(target_os = "freebsd", any(freebsd11, freebsd10)),
1264         link_name = "mknod@FBSD_1.0"
1265     )]
mknod( pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t, ) -> ::c_int1266     pub fn mknod(
1267         pathname: *const ::c_char,
1268         mode: ::mode_t,
1269         dev: ::dev_t,
1270     ) -> ::c_int;
gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1271     pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
getservbyname( name: *const ::c_char, proto: *const ::c_char, ) -> *mut servent1272     pub fn getservbyname(
1273         name: *const ::c_char,
1274         proto: *const ::c_char,
1275     ) -> *mut servent;
getprotobyname(name: *const ::c_char) -> *mut protoent1276     pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
getprotobynumber(proto: ::c_int) -> *mut protoent1277     pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
chroot(name: *const ::c_char) -> ::c_int1278     pub fn chroot(name: *const ::c_char) -> ::c_int;
1279     #[cfg_attr(
1280         all(target_os = "macos", target_arch = "x86"),
1281         link_name = "usleep$UNIX2003"
1282     )]
usleep(secs: ::c_uint) -> ::c_int1283     pub fn usleep(secs: ::c_uint) -> ::c_int;
1284     #[cfg_attr(
1285         all(target_os = "macos", target_arch = "x86"),
1286         link_name = "send$UNIX2003"
1287     )]
send( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, ) -> ::ssize_t1288     pub fn send(
1289         socket: ::c_int,
1290         buf: *const ::c_void,
1291         len: ::size_t,
1292         flags: ::c_int,
1293     ) -> ::ssize_t;
1294     #[cfg_attr(
1295         all(target_os = "macos", target_arch = "x86"),
1296         link_name = "recv$UNIX2003"
1297     )]
recv( socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, ) -> ::ssize_t1298     pub fn recv(
1299         socket: ::c_int,
1300         buf: *mut ::c_void,
1301         len: ::size_t,
1302         flags: ::c_int,
1303     ) -> ::ssize_t;
1304     #[cfg_attr(
1305         all(target_os = "macos", target_arch = "x86"),
1306         link_name = "putenv$UNIX2003"
1307     )]
1308     #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
putenv(string: *mut c_char) -> ::c_int1309     pub fn putenv(string: *mut c_char) -> ::c_int;
1310     #[cfg_attr(
1311         all(target_os = "macos", target_arch = "x86"),
1312         link_name = "poll$UNIX2003"
1313     )]
poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1314     pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
1315     #[cfg_attr(
1316         all(target_os = "macos", target_arch = "x86_64"),
1317         link_name = "select$1050"
1318     )]
1319     #[cfg_attr(
1320         all(target_os = "macos", target_arch = "x86"),
1321         link_name = "select$UNIX2003"
1322     )]
1323     #[cfg_attr(target_os = "netbsd", link_name = "__select50")]
select( nfds: ::c_int, readfs: *mut fd_set, writefds: *mut fd_set, errorfds: *mut fd_set, timeout: *mut timeval, ) -> ::c_int1324     pub fn select(
1325         nfds: ::c_int,
1326         readfs: *mut fd_set,
1327         writefds: *mut fd_set,
1328         errorfds: *mut fd_set,
1329         timeout: *mut timeval,
1330     ) -> ::c_int;
1331     #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
setlocale( category: ::c_int, locale: *const ::c_char, ) -> *mut ::c_char1332     pub fn setlocale(
1333         category: ::c_int,
1334         locale: *const ::c_char,
1335     ) -> *mut ::c_char;
localeconv() -> *mut lconv1336     pub fn localeconv() -> *mut lconv;
1337 
1338     #[cfg_attr(
1339         all(target_os = "macos", target_arch = "x86"),
1340         link_name = "sem_wait$UNIX2003"
1341     )]
sem_wait(sem: *mut sem_t) -> ::c_int1342     pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
sem_trywait(sem: *mut sem_t) -> ::c_int1343     pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
sem_post(sem: *mut sem_t) -> ::c_int1344     pub fn sem_post(sem: *mut sem_t) -> ::c_int;
statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int1345     pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int1346     pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
1347 
readlink( path: *const c_char, buf: *mut c_char, bufsz: ::size_t, ) -> ::ssize_t1348     pub fn readlink(
1349         path: *const c_char,
1350         buf: *mut c_char,
1351         bufsz: ::size_t,
1352     ) -> ::ssize_t;
1353 
1354     #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
sigemptyset(set: *mut sigset_t) -> ::c_int1355     pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
1356     #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1357     pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1358     #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
sigfillset(set: *mut sigset_t) -> ::c_int1359     pub fn sigfillset(set: *mut sigset_t) -> ::c_int;
1360     #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1361     pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1362     #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int1363     pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
1364 
1365     #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
sigprocmask( how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t, ) -> ::c_int1366     pub fn sigprocmask(
1367         how: ::c_int,
1368         set: *const sigset_t,
1369         oldset: *mut sigset_t,
1370     ) -> ::c_int;
1371     #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
sigpending(set: *mut sigset_t) -> ::c_int1372     pub fn sigpending(set: *mut sigset_t) -> ::c_int;
1373 
1374     #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
timegm(tm: *mut ::tm) -> time_t1375     pub fn timegm(tm: *mut ::tm) -> time_t;
1376 
sysconf(name: ::c_int) -> ::c_long1377     pub fn sysconf(name: ::c_int) -> ::c_long;
1378 
mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1379     pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
1380 
1381     #[cfg_attr(
1382         all(target_os = "macos", target_arch = "x86_64"),
1383         link_name = "pselect$1050"
1384     )]
1385     #[cfg_attr(
1386         all(target_os = "macos", target_arch = "x86"),
1387         link_name = "pselect$UNIX2003"
1388     )]
1389     #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
pselect( nfds: ::c_int, readfs: *mut fd_set, writefds: *mut fd_set, errorfds: *mut fd_set, timeout: *const timespec, sigmask: *const sigset_t, ) -> ::c_int1390     pub fn pselect(
1391         nfds: ::c_int,
1392         readfs: *mut fd_set,
1393         writefds: *mut fd_set,
1394         errorfds: *mut fd_set,
1395         timeout: *const timespec,
1396         sigmask: *const sigset_t,
1397     ) -> ::c_int;
fseeko( stream: *mut ::FILE, offset: ::off_t, whence: ::c_int, ) -> ::c_int1398     pub fn fseeko(
1399         stream: *mut ::FILE,
1400         offset: ::off_t,
1401         whence: ::c_int,
1402     ) -> ::c_int;
ftello(stream: *mut ::FILE) -> ::off_t1403     pub fn ftello(stream: *mut ::FILE) -> ::off_t;
1404     #[cfg_attr(
1405         all(target_os = "macos", target_arch = "x86"),
1406         link_name = "tcdrain$UNIX2003"
1407     )]
tcdrain(fd: ::c_int) -> ::c_int1408     pub fn tcdrain(fd: ::c_int) -> ::c_int;
cfgetispeed(termios: *const ::termios) -> ::speed_t1409     pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
cfgetospeed(termios: *const ::termios) -> ::speed_t1410     pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t;
cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1411     pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1412     pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int1413     pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
tcsetattr( fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios, ) -> ::c_int1414     pub fn tcsetattr(
1415         fd: ::c_int,
1416         optional_actions: ::c_int,
1417         termios: *const ::termios,
1418     ) -> ::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(
1446         lineptr: *mut *mut c_char,
1447         n: *mut size_t,
1448         stream: *mut FILE,
1449     ) -> ssize_t;
1450 }
1451 
1452 cfg_if! {
1453     if #[cfg(not(target_os = "redox"))] {
1454         extern {
1455             pub fn getsid(pid: pid_t) -> pid_t;
1456             pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
1457             #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1458                        link_name = "pause$UNIX2003")]
1459             pub fn pause() -> ::c_int;
1460 
1461             pub fn readlinkat(dirfd: ::c_int,
1462                               pathname: *const ::c_char,
1463                               buf: *mut ::c_char,
1464                               bufsiz: ::size_t) -> ::ssize_t;
1465             pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
1466                            mode: ::mode_t) -> ::c_int;
1467             pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
1468                           flags: ::c_int, ...) -> ::c_int;
1469 
1470             #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1471                        link_name = "fdopendir$INODE64")]
1472             #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1473                        link_name = "fdopendir$INODE64$UNIX2003")]
1474             pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
1475 
1476             #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
1477             #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
1478             #[cfg_attr(
1479                 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1480                 link_name = "readdir_r@FBSD_1.0"
1481             )]
1482             /// The 64-bit libc on Solaris and illumos only has readdir_r.  If a
1483             /// 32-bit Solaris or illumos target is ever created, it should use
1484             /// __posix_readdir_r.  See libc(3LIB) on Solaris or illumos:
1485             /// https://illumos.org/man/3lib/libc
1486             /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html
1487             /// https://www.unix.com/man-page/opensolaris/3LIB/libc/
1488             pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
1489                              result: *mut *mut ::dirent) -> ::c_int;
1490         }
1491     }
1492 }
1493 
1494 cfg_if! {
1495    if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] {
1496         extern {
1497             pub fn cfmakeraw(termios: *mut ::termios);
1498             pub fn cfsetspeed(termios: *mut ::termios,
1499                               speed: ::speed_t) -> ::c_int;
1500         }
1501    }
1502 }
1503 
1504 cfg_if! {
1505     if #[cfg(target_env = "uclibc")] {
1506         mod uclibc;
1507         pub use self::uclibc::*;
1508     } else if #[cfg(target_env = "newlib")] {
1509         mod newlib;
1510         pub use self::newlib::*;
1511     } else if #[cfg(any(target_os = "linux",
1512                         target_os = "android",
1513                         target_os = "emscripten"))] {
1514         mod linux_like;
1515         pub use self::linux_like::*;
1516     } else if #[cfg(any(target_os = "macos",
1517                         target_os = "ios",
1518                         target_os = "freebsd",
1519                         target_os = "dragonfly",
1520                         target_os = "openbsd",
1521                         target_os = "netbsd"))] {
1522         mod bsd;
1523         pub use self::bsd::*;
1524     } else if #[cfg(any(target_os = "solaris",
1525                         target_os = "illumos"))] {
1526         mod solarish;
1527         pub use self::solarish::*;
1528     } else if #[cfg(target_os = "haiku")] {
1529         mod haiku;
1530         pub use self::haiku::*;
1531     } else if #[cfg(target_os = "hermit")] {
1532         mod hermit;
1533         pub use self::hermit::*;
1534     } else if #[cfg(target_os = "redox")] {
1535         mod redox;
1536         pub use self::redox::*;
1537     } else {
1538         // Unknown target_os
1539     }
1540 }
1541 
1542 cfg_if! {
1543     if #[cfg(libc_core_cvoid)] {
1544         pub use ::ffi::c_void;
1545     } else {
1546         // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
1547         // enable more optimization opportunities around it recognizing things
1548         // like malloc/free.
1549         #[repr(u8)]
1550         #[allow(missing_copy_implementations)]
1551         #[allow(missing_debug_implementations)]
1552         pub enum c_void {
1553             // Two dummy variants so the #[repr] attribute can be used.
1554             #[doc(hidden)]
1555             __variant1,
1556             #[doc(hidden)]
1557             __variant2,
1558         }
1559     }
1560 }
1561 
1562 cfg_if! {
1563     if #[cfg(libc_align)] {
1564         mod align;
1565         pub use self::align::*;
1566     } else {
1567         mod no_align;
1568         pub use self::no_align::*;
1569     }
1570 }
1571