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 { *self }
38 }
39 pub type locale_t = *mut :: c_void;
40 
41 s! {
42     pub struct group {
43         pub gr_name: *mut ::c_char,
44         pub gr_passwd: *mut ::c_char,
45         pub gr_gid: ::gid_t,
46         pub gr_mem: *mut *mut ::c_char,
47     }
48 
49     pub struct utimbuf {
50         pub actime: time_t,
51         pub modtime: time_t,
52     }
53 
54     pub struct timeval {
55         pub tv_sec: time_t,
56         pub tv_usec: suseconds_t,
57     }
58 
59     // linux x32 compatibility
60     // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
61     pub struct timespec {
62         pub tv_sec: time_t,
63         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
64         pub tv_nsec: i64,
65         #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
66         pub tv_nsec: ::c_long,
67     }
68 
69     pub struct rlimit {
70         pub rlim_cur: rlim_t,
71         pub rlim_max: rlim_t,
72     }
73 
74     pub struct rusage {
75         pub ru_utime: timeval,
76         pub ru_stime: timeval,
77         pub ru_maxrss: c_long,
78         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
79         __pad1: u32,
80         pub ru_ixrss: c_long,
81         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
82         __pad2: u32,
83         pub ru_idrss: c_long,
84         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
85         __pad3: u32,
86         pub ru_isrss: c_long,
87         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
88         __pad4: u32,
89         pub ru_minflt: c_long,
90         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
91         __pad5: u32,
92         pub ru_majflt: c_long,
93         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
94         __pad6: u32,
95         pub ru_nswap: c_long,
96         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
97         __pad7: u32,
98         pub ru_inblock: c_long,
99         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
100         __pad8: u32,
101         pub ru_oublock: c_long,
102         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
103         __pad9: u32,
104         pub ru_msgsnd: c_long,
105         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
106         __pad10: u32,
107         pub ru_msgrcv: c_long,
108         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
109         __pad11: u32,
110         pub ru_nsignals: c_long,
111         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
112         __pad12: u32,
113         pub ru_nvcsw: c_long,
114         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
115         __pad13: u32,
116         pub ru_nivcsw: c_long,
117         #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
118         __pad14: u32,
119 
120         #[cfg(any(target_env = "musl", target_os = "emscripten"))]
121         __reserved: [c_long; 16],
122     }
123 
124     pub struct ipv6_mreq {
125         pub ipv6mr_multiaddr: in6_addr,
126         #[cfg(target_os = "android")]
127         pub ipv6mr_interface: ::c_int,
128         #[cfg(not(target_os = "android"))]
129         pub ipv6mr_interface: ::c_uint,
130     }
131 
132     pub struct hostent {
133         pub h_name: *mut ::c_char,
134         pub h_aliases: *mut *mut ::c_char,
135         pub h_addrtype: ::c_int,
136         pub h_length: ::c_int,
137         pub h_addr_list: *mut *mut ::c_char,
138     }
139 
140     pub struct iovec {
141         pub iov_base: *mut ::c_void,
142         pub iov_len: ::size_t,
143     }
144 
145     pub struct pollfd {
146         pub fd: ::c_int,
147         pub events: ::c_short,
148         pub revents: ::c_short,
149     }
150 
151     pub struct winsize {
152         pub ws_row: ::c_ushort,
153         pub ws_col: ::c_ushort,
154         pub ws_xpixel: ::c_ushort,
155         pub ws_ypixel: ::c_ushort,
156     }
157 
158     pub struct linger {
159         pub l_onoff: ::c_int,
160         pub l_linger: ::c_int,
161     }
162 
163     pub struct sigval {
164         // Actually a union of an int and a void*
165         pub sival_ptr: *mut ::c_void
166     }
167 
168     // <sys/time.h>
169     pub struct itimerval {
170         pub it_interval: ::timeval,
171         pub it_value: ::timeval,
172     }
173 
174     // <sys/times.h>
175     pub struct tms {
176         pub tms_utime: ::clock_t,
177         pub tms_stime: ::clock_t,
178         pub tms_cutime: ::clock_t,
179         pub tms_cstime: ::clock_t,
180     }
181 
182     pub struct servent {
183         pub s_name: *mut ::c_char,
184         pub s_aliases: *mut *mut ::c_char,
185         pub s_port: ::c_int,
186         pub s_proto: *mut ::c_char,
187     }
188 
189     pub struct protoent {
190         pub p_name: *mut ::c_char,
191         pub p_aliases: *mut *mut ::c_char,
192         pub p_proto: ::c_int,
193     }
194 }
195 
196 pub const INT_MIN: c_int = -2147483648;
197 pub const INT_MAX: c_int = 2147483647;
198 
199 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
200 pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
201 pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
202 
203 pub const DT_UNKNOWN: u8 = 0;
204 pub const DT_FIFO: u8 = 1;
205 pub const DT_CHR: u8 = 2;
206 pub const DT_DIR: u8 = 4;
207 pub const DT_BLK: u8 = 6;
208 pub const DT_REG: u8 = 8;
209 pub const DT_LNK: u8 = 10;
210 pub const DT_SOCK: u8 = 12;
211 
212 cfg_if! {
213     if #[cfg(not(target_os = "redox"))] {
214         pub const FD_CLOEXEC: ::c_int = 0x1;
215     }
216 }
217 
218 pub const USRQUOTA: ::c_int = 0;
219 pub const GRPQUOTA: ::c_int = 1;
220 
221 pub const SIGIOT: ::c_int = 6;
222 
223 pub const S_ISUID: ::mode_t = 0x800;
224 pub const S_ISGID: ::mode_t = 0x400;
225 pub const S_ISVTX: ::mode_t = 0x200;
226 
227 pub const IF_NAMESIZE: ::size_t = 16;
228 pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
229 
230 pub const LOG_EMERG: ::c_int = 0;
231 pub const LOG_ALERT: ::c_int = 1;
232 pub const LOG_CRIT: ::c_int = 2;
233 pub const LOG_ERR: ::c_int = 3;
234 pub const LOG_WARNING: ::c_int = 4;
235 pub const LOG_NOTICE: ::c_int = 5;
236 pub const LOG_INFO: ::c_int = 6;
237 pub const LOG_DEBUG: ::c_int = 7;
238 
239 pub const LOG_KERN: ::c_int = 0;
240 pub const LOG_USER: ::c_int = 1 << 3;
241 pub const LOG_MAIL: ::c_int = 2 << 3;
242 pub const LOG_DAEMON: ::c_int = 3 << 3;
243 pub const LOG_AUTH: ::c_int = 4 << 3;
244 pub const LOG_SYSLOG: ::c_int = 5 << 3;
245 pub const LOG_LPR: ::c_int = 6 << 3;
246 pub const LOG_NEWS: ::c_int = 7 << 3;
247 pub const LOG_UUCP: ::c_int = 8 << 3;
248 pub const LOG_LOCAL0: ::c_int = 16 << 3;
249 pub const LOG_LOCAL1: ::c_int = 17 << 3;
250 pub const LOG_LOCAL2: ::c_int = 18 << 3;
251 pub const LOG_LOCAL3: ::c_int = 19 << 3;
252 pub const LOG_LOCAL4: ::c_int = 20 << 3;
253 pub const LOG_LOCAL5: ::c_int = 21 << 3;
254 pub const LOG_LOCAL6: ::c_int = 22 << 3;
255 pub const LOG_LOCAL7: ::c_int = 23 << 3;
256 
257 pub const LOG_PID: ::c_int = 0x01;
258 pub const LOG_CONS: ::c_int = 0x02;
259 pub const LOG_ODELAY: ::c_int = 0x04;
260 pub const LOG_NDELAY: ::c_int = 0x08;
261 pub const LOG_NOWAIT: ::c_int = 0x10;
262 
263 pub const LOG_PRIMASK: ::c_int = 7;
264 pub const LOG_FACMASK: ::c_int = 0x3f8;
265 
266 pub const PRIO_PROCESS: ::c_int = 0;
267 pub const PRIO_PGRP: ::c_int = 1;
268 pub const PRIO_USER: ::c_int = 2;
269 
270 pub const PRIO_MIN: ::c_int = -20;
271 pub const PRIO_MAX: ::c_int = 20;
272 
273 pub const IPPROTO_ICMP: ::c_int = 1;
274 pub const IPPROTO_ICMPV6: ::c_int = 58;
275 pub const IPPROTO_TCP: ::c_int = 6;
276 pub const IPPROTO_UDP: ::c_int = 17;
277 pub const IPPROTO_IP: ::c_int = 0;
278 pub const IPPROTO_IPV6: ::c_int = 41;
279 
280 pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
281 pub const INADDR_ANY: in_addr_t = 0;
282 pub const INADDR_BROADCAST: in_addr_t = 4294967295;
283 pub const INADDR_NONE: in_addr_t = 4294967295;
284 
285 pub const ARPOP_REQUEST: u16 = 1;
286 pub const ARPOP_REPLY: u16 = 2;
287 
288 pub const ATF_COM: ::c_int = 0x02;
289 pub const ATF_PERM: ::c_int = 0x04;
290 pub const ATF_PUBL: ::c_int = 0x08;
291 pub const ATF_USETRAILERS: ::c_int = 0x10;
292 
293 cfg_if! {
294     if #[cfg(target_os = "l4re")] {
295         // required libraries for L4Re are linked externally, ATM
296     } else if #[cfg(feature = "std")] {
297         // cargo build, don't pull in anything extra as the libstd dep
298         // already pulls in all libs.
299     } else if #[cfg(target_env = "musl")] {
300         #[cfg_attr(feature = "rustc-dep-of-std",
301                    link(name = "c", kind = "static",
302                         cfg(target_feature = "crt-static")))]
303         #[cfg_attr(feature = "rustc-dep-of-std",
304                    link(name = "c", cfg(not(target_feature = "crt-static"))))]
305         extern {}
306     } else if #[cfg(target_os = "emscripten")] {
307         #[link(name = "c")]
308         extern {}
309     } else if #[cfg(all(target_os = "netbsd",
310                         feature = "rustc-dep-of-std",
311                         target_vendor = "rumprun"))] {
312         // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
313         // in automatically by the linker. We avoid passing it explicitly, as it
314         // causes some versions of binutils to crash with an assertion failure.
315         #[link(name = "m")]
316         extern {}
317     } else if #[cfg(any(target_os = "macos",
318                         target_os = "ios",
319                         target_os = "android",
320                         target_os = "openbsd"))] {
321         #[link(name = "c")]
322         #[link(name = "m")]
323         extern {}
324     } else if #[cfg(target_os = "haiku")] {
325         #[link(name = "root")]
326         #[link(name = "network")]
327         extern {}
328     } else if #[cfg(target_env = "newlib")] {
329         #[link(name = "c")]
330         #[link(name = "m")]
331         extern {}
332     } else if #[cfg(target_os = "hermit")] {
333         // no_default_libraries is set to false for HermitCore, so only a link
334         // to "pthread" needs to be added.
335         #[link(name = "pthread")]
336         extern {}
337     } else if #[cfg(target_env = "illumos")] {
338         #[link(name = "c")]
339         #[link(name = "m")]
340         extern {}
341     } else if #[cfg(target_os = "redox")] {
342         #[cfg_attr(feature = "rustc-dep-of-std",
343                    link(name = "c", kind = "static-nobundle",
344                         cfg(target_feature = "crt-static")))]
345         #[cfg_attr(feature = "rustc-dep-of-std",
346                    link(name = "c", cfg(not(target_feature = "crt-static"))))]
347         extern {}
348     } else {
349         #[link(name = "c")]
350         #[link(name = "m")]
351         #[link(name = "rt")]
352         #[link(name = "pthread")]
353         extern {}
354     }
355 }
356 
357 #[cfg_attr(feature = "extra_traits", derive(Debug))]
358 pub enum FILE {}
359 impl ::Copy for FILE {}
360 impl ::Clone for FILE {
clone(&self) -> FILE361     fn clone(&self) -> FILE { *self }
362 }
363 #[cfg_attr(feature = "extra_traits", derive(Debug))]
364 pub enum fpos_t {} // TODO: fill this out with a struct
365 impl ::Copy for fpos_t {}
366 impl ::Clone for fpos_t {
clone(&self) -> fpos_t367     fn clone(&self) -> fpos_t { *self }
368 }
369 
370 extern {
isalnum(c: c_int) -> c_int371     pub fn isalnum(c: c_int) -> c_int;
isalpha(c: c_int) -> c_int372     pub fn isalpha(c: c_int) -> c_int;
iscntrl(c: c_int) -> c_int373     pub fn iscntrl(c: c_int) -> c_int;
isdigit(c: c_int) -> c_int374     pub fn isdigit(c: c_int) -> c_int;
isgraph(c: c_int) -> c_int375     pub fn isgraph(c: c_int) -> c_int;
islower(c: c_int) -> c_int376     pub fn islower(c: c_int) -> c_int;
isprint(c: c_int) -> c_int377     pub fn isprint(c: c_int) -> c_int;
ispunct(c: c_int) -> c_int378     pub fn ispunct(c: c_int) -> c_int;
isspace(c: c_int) -> c_int379     pub fn isspace(c: c_int) -> c_int;
isupper(c: c_int) -> c_int380     pub fn isupper(c: c_int) -> c_int;
isxdigit(c: c_int) -> c_int381     pub fn isxdigit(c: c_int) -> c_int;
tolower(c: c_int) -> c_int382     pub fn tolower(c: c_int) -> c_int;
toupper(c: c_int) -> c_int383     pub fn toupper(c: c_int) -> c_int;
384     #[cfg_attr(
385         all(target_os = "macos", target_arch = "x86"),
386         link_name = "fopen$UNIX2003"
387     )]
fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE388     pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
389     #[cfg_attr(
390         all(target_os = "macos", target_arch = "x86"),
391         link_name = "freopen$UNIX2003"
392     )]
freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE393     pub fn freopen(filename: *const c_char, mode: *const c_char,
394                    file: *mut FILE) -> *mut FILE;
fflush(file: *mut FILE) -> c_int395     pub fn fflush(file: *mut FILE) -> c_int;
fclose(file: *mut FILE) -> c_int396     pub fn fclose(file: *mut FILE) -> c_int;
remove(filename: *const c_char) -> c_int397     pub fn remove(filename: *const c_char) -> c_int;
rename(oldname: *const c_char, newname: *const c_char) -> c_int398     pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
tmpfile() -> *mut FILE399     pub fn tmpfile() -> *mut FILE;
setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int400     pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int,
401                    size: size_t) -> c_int;
setbuf(stream: *mut FILE, buf: *mut c_char)402     pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
getchar() -> c_int403     pub fn getchar() -> c_int;
putchar(c: c_int) -> c_int404     pub fn putchar(c: c_int) -> c_int;
fgetc(stream: *mut FILE) -> c_int405     pub fn fgetc(stream: *mut FILE) -> c_int;
fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char406     pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
fputc(c: c_int, stream: *mut FILE) -> c_int407     pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
408     #[cfg_attr(
409         all(target_os = "macos", target_arch = "x86"),
410         link_name = "fputs$UNIX2003"
411     )]
fputs(s: *const c_char, stream: *mut FILE) -> c_int412     pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
puts(s: *const c_char) -> c_int413     pub fn puts(s: *const c_char) -> c_int;
ungetc(c: c_int, stream: *mut FILE) -> c_int414     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_t415     pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t,
416                  stream: *mut FILE) -> size_t;
417     #[cfg_attr(
418         all(target_os = "macos", target_arch = "x86"),
419         link_name = "fwrite$UNIX2003"
420     )]
fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t421     pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t,
422                   stream: *mut FILE) -> size_t;
fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int423     pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
ftell(stream: *mut FILE) -> c_long424     pub fn ftell(stream: *mut FILE) -> c_long;
rewind(stream: *mut FILE)425     pub fn rewind(stream: *mut FILE);
426     #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int427     pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
428     #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int429     pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
feof(stream: *mut FILE) -> c_int430     pub fn feof(stream: *mut FILE) -> c_int;
ferror(stream: *mut FILE) -> c_int431     pub fn ferror(stream: *mut FILE) -> c_int;
perror(s: *const c_char)432     pub fn perror(s: *const c_char);
atoi(s: *const c_char) -> c_int433     pub fn atoi(s: *const c_char) -> c_int;
434     #[cfg_attr(
435         all(target_os = "macos", target_arch = "x86"),
436         link_name = "strtod$UNIX2003"
437     )]
strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double438     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_long439     pub fn strtol(s: *const c_char, endp: *mut *mut c_char,
440                   base: c_int) -> c_long;
strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong441     pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
442                    base: c_int) -> c_ulong;
calloc(nobj: size_t, size: size_t) -> *mut c_void443     pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
malloc(size: size_t) -> *mut c_void444     pub fn malloc(size: size_t) -> *mut c_void;
realloc(p: *mut c_void, size: size_t) -> *mut c_void445     pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
free(p: *mut c_void)446     pub fn free(p: *mut c_void);
abort() -> !447     pub fn abort() -> !;
exit(status: c_int) -> !448     pub fn exit(status: c_int) -> !;
_exit(status: c_int) -> !449     pub fn _exit(status: c_int) -> !;
atexit(cb: extern fn()) -> c_int450     pub fn atexit(cb: extern fn()) -> c_int;
451     #[cfg_attr(
452         all(target_os = "macos", target_arch = "x86"),
453         link_name = "system$UNIX2003"
454     )]
system(s: *const c_char) -> c_int455     pub fn system(s: *const c_char) -> c_int;
getenv(s: *const c_char) -> *mut c_char456     pub fn getenv(s: *const c_char) -> *mut c_char;
457 
strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char458     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_char459     pub fn strncpy(dst: *mut c_char, src: *const c_char,
460                    n: size_t) -> *mut c_char;
strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char461     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_char462     pub fn strncat(s: *mut c_char, ct: *const c_char,
463                    n: size_t) -> *mut c_char;
strcmp(cs: *const c_char, ct: *const c_char) -> c_int464     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_int465     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_int466     pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
strchr(cs: *const c_char, c: c_int) -> *mut c_char467     pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
strrchr(cs: *const c_char, c: c_int) -> *mut c_char468     pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
strspn(cs: *const c_char, ct: *const c_char) -> size_t469     pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
strcspn(cs: *const c_char, ct: *const c_char) -> size_t470     pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
strdup(cs: *const c_char) -> *mut c_char471     pub fn strdup(cs: *const c_char) -> *mut c_char;
strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char472     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_char473     pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int474     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_int475     pub fn strncasecmp(s1: *const c_char, s2: *const c_char,
476                        n: size_t) -> c_int;
strlen(cs: *const c_char) -> size_t477     pub fn strlen(cs: *const c_char) -> size_t;
strnlen(cs: *const c_char, maxlen: size_t) -> size_t478     pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
479     #[cfg_attr(
480         all(target_os = "macos", target_arch = "x86"),
481         link_name = "strerror$UNIX2003"
482     )]
strerror(n: c_int) -> *mut c_char483     pub fn strerror(n: c_int) -> *mut c_char;
strtok(s: *mut c_char, t: *const c_char) -> *mut c_char484     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_t485     pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
wcslen(buf: *const wchar_t) -> size_t486     pub fn wcslen(buf: *const wchar_t) -> size_t;
wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t487     pub fn wcstombs(dest: *mut c_char, src: *const wchar_t,
488                     n: size_t) -> ::size_t;
489 
memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void490     pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int491     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_void492     pub fn memcpy(dest: *mut c_void, src: *const c_void,
493                   n: size_t) -> *mut c_void;
memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void494     pub fn memmove(dest: *mut c_void, src: *const c_void,
495                    n: size_t) -> *mut c_void;
memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void496     pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
497 }
498 
499 extern {
500     #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
getpwnam(name: *const ::c_char) -> *mut passwd501     pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
502     #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
getpwuid(uid: ::uid_t) -> *mut passwd503     pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
504 
fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int505     pub fn fprintf(stream: *mut ::FILE,
506                    format: *const ::c_char, ...) -> ::c_int;
printf(format: *const ::c_char, ...) -> ::c_int507     pub fn printf(format: *const ::c_char, ...) -> ::c_int;
snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int508     pub fn snprintf(s: *mut ::c_char, n: ::size_t,
509                     format: *const ::c_char, ...) -> ::c_int;
sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int510     pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
511     #[cfg_attr(target_os = "linux", link_name = "__isoc99_fscanf")]
fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int512     pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
513     #[cfg_attr(target_os = "linux", link_name = "__isoc99_scanf")]
scanf(format: *const ::c_char, ...) -> ::c_int514     pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
515     #[cfg_attr(target_os = "linux", link_name = "__isoc99_sscanf")]
sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int516     pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
getchar_unlocked() -> ::c_int517     pub fn getchar_unlocked() -> ::c_int;
putchar_unlocked(c: ::c_int) -> ::c_int518     pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
519 
520     #[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
521     #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int522     pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
523     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
524                link_name = "connect$UNIX2003")]
525     #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")]
connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int526     pub fn connect(socket: ::c_int, address: *const sockaddr,
527                    len: socklen_t) -> ::c_int;
528     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
529                link_name = "listen$UNIX2003")]
530     #[cfg_attr(target_os = "illumos", link_name = "__xnet_listen")]
listen(socket: ::c_int, backlog: ::c_int) -> ::c_int531     pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
532     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
533                link_name = "accept$UNIX2003")]
accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int534     pub fn accept(socket: ::c_int, address: *mut sockaddr,
535                   address_len: *mut socklen_t) -> ::c_int;
536     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
537                link_name = "getpeername$UNIX2003")]
getpeername(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int538     pub fn getpeername(socket: ::c_int, address: *mut sockaddr,
539                        address_len: *mut socklen_t) -> ::c_int;
540     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
541                link_name = "getsockname$UNIX2003")]
getsockname(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int542     pub fn getsockname(socket: ::c_int, address: *mut sockaddr,
543                        address_len: *mut socklen_t) -> ::c_int;
setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, option_len: socklen_t) -> ::c_int544     pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int,
545                       value: *const ::c_void,
546                       option_len: socklen_t) -> ::c_int;
547     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
548                link_name = "socketpair$UNIX2003")]
549     #[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_int550     pub fn socketpair(domain: ::c_int, type_: ::c_int, protocol: ::c_int,
551                       socket_vector: *mut ::c_int) -> ::c_int;
552     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
553                link_name = "sendto$UNIX2003")]
554     #[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_t555     pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
556                   flags: ::c_int, addr: *const sockaddr,
557                   addrlen: socklen_t) -> ::ssize_t;
shutdown(socket: ::c_int, how: ::c_int) -> ::c_int558     pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
559 
560     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
561                link_name = "chmod$UNIX2003")]
chmod(path: *const c_char, mode: mode_t) -> ::c_int562     pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int;
563     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
564                link_name = "fchmod$UNIX2003")]
fchmod(fd: ::c_int, mode: mode_t) -> ::c_int565     pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
566 
567     #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")]
568     #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
569     #[cfg_attr(
570         all(target_os = "freebsd", not(freebsd12)),
571         link_name = "fstat@FBSD_1.0"
572     )]
fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int573     pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
574 
mkdir(path: *const c_char, mode: mode_t) -> ::c_int575     pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
576 
577     #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
578     #[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
579     #[cfg_attr(
580         all(target_os = "freebsd", not(freebsd12)),
581         link_name = "stat@FBSD_1.0"
582     )]
stat(path: *const c_char, buf: *mut stat) -> ::c_int583     pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
584 
pclose(stream: *mut ::FILE) -> ::c_int585     pub fn pclose(stream: *mut ::FILE) -> ::c_int;
586     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
587                link_name = "fdopen$UNIX2003")]
fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE588     pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
fileno(stream: *mut ::FILE) -> ::c_int589     pub fn fileno(stream: *mut ::FILE) -> ::c_int;
590 
591     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
592                link_name = "open$UNIX2003")]
open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int593     pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
594     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
595                link_name = "creat$UNIX2003")]
creat(path: *const c_char, mode: mode_t) -> ::c_int596     pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
597     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
598                link_name = "fcntl$UNIX2003")]
fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int599     pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
600 
601     #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
602                link_name = "opendir$INODE64")]
603     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
604                link_name = "opendir$INODE64$UNIX2003")]
605     #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
opendir(dirname: *const c_char) -> *mut ::DIR606     pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
607 
608     #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
609                link_name = "fdopendir$INODE64")]
610     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
611                link_name = "fdopendir$INODE64$UNIX2003")]
fdopendir(fd: ::c_int) -> *mut ::DIR612     pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
613 
614     #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
615     #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
616     #[cfg_attr(
617         all(target_os = "freebsd", not(freebsd12)),
618         link_name = "readdir@FBSD_1.0"
619     )]
readdir(dirp: *mut ::DIR) -> *mut ::dirent620     pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
621     #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
622     #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
623     #[cfg_attr(
624         all(target_os = "freebsd", not(freebsd12)),
625         link_name = "readdir_r@FBSD_1.0"
626     )]
627     /// The 64-bit libc on Solaris and illumos only has readdir_r.  If a
628     /// 32-bit Solaris or illumos target is ever created, it should use
629     /// __posix_readdir_r.  See libc(3LIB) on Solaris or illumos:
630     /// https://illumos.org/man/3lib/libc
631     /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html
632     /// https://www.unix.com/man-page/opensolaris/3LIB/libc/
readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent) -> ::c_int633     pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
634                      result: *mut *mut ::dirent) -> ::c_int;
635     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
636                link_name = "closedir$UNIX2003")]
closedir(dirp: *mut ::DIR) -> ::c_int637     pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
638     #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
639                link_name = "rewinddir$INODE64")]
640     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
641                link_name = "rewinddir$INODE64$UNIX2003")]
rewinddir(dirp: *mut ::DIR)642     pub fn rewinddir(dirp: *mut ::DIR);
643 
openat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ...) -> ::c_int644     pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
645                   flags: ::c_int, ...) -> ::c_int;
fchmodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, flags: ::c_int) -> ::c_int646     pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
647                     mode: ::mode_t, flags: ::c_int) -> ::c_int;
fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int648     pub fn fchown(fd: ::c_int,
649                   owner: ::uid_t,
650                   group: ::gid_t) -> ::c_int;
fchownat(dirfd: ::c_int, pathname: *const ::c_char, owner: ::uid_t, group: ::gid_t, flags: ::c_int) -> ::c_int651     pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
652                     owner: ::uid_t, group: ::gid_t,
653                     flags: ::c_int) -> ::c_int;
654     #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
655     #[cfg_attr(
656         all(target_os = "freebsd", not(freebsd12)),
657         link_name = "fstatat@FBSD_1.1"
658     )]
fstatat(dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int) -> ::c_int659     pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
660                    buf: *mut stat, flags: ::c_int) -> ::c_int;
linkat(olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int) -> ::c_int661     pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
662                   newdirfd: ::c_int, newpath: *const ::c_char,
663                   flags: ::c_int) -> ::c_int;
mkdirat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int664     pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
665                    mode: ::mode_t) -> ::c_int;
readlinkat(dirfd: ::c_int, pathname: *const ::c_char, buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t666     pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
667                       buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
renameat(olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char) -> ::c_int668     pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
669                     newdirfd: ::c_int, newpath: *const ::c_char)
670                     -> ::c_int;
symlinkat(target: *const ::c_char, newdirfd: ::c_int, linkpath: *const ::c_char) -> ::c_int671     pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
672                      linkpath: *const ::c_char) -> ::c_int;
unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int673     pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
674                     flags: ::c_int) -> ::c_int;
675 
access(path: *const c_char, amode: ::c_int) -> ::c_int676     pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
alarm(seconds: ::c_uint) -> ::c_uint677     pub fn alarm(seconds: ::c_uint) -> ::c_uint;
chdir(dir: *const c_char) -> ::c_int678     pub fn chdir(dir: *const c_char) -> ::c_int;
fchdir(dirfd: ::c_int) -> ::c_int679     pub fn fchdir(dirfd: ::c_int) -> ::c_int;
chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int680     pub fn chown(path: *const c_char, uid: uid_t,
681                  gid: gid_t) -> ::c_int;
682     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
683                link_name = "lchown$UNIX2003")]
lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int684     pub fn lchown(path: *const c_char, uid: uid_t,
685                   gid: gid_t) -> ::c_int;
686     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
687                link_name = "close$NOCANCEL$UNIX2003")]
688     #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
689                link_name = "close$NOCANCEL")]
close(fd: ::c_int) -> ::c_int690     pub fn close(fd: ::c_int) -> ::c_int;
dup(fd: ::c_int) -> ::c_int691     pub fn dup(fd: ::c_int) -> ::c_int;
dup2(src: ::c_int, dst: ::c_int) -> ::c_int692     pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int693     pub fn execl(path: *const c_char,
694                  arg0: *const c_char, ...) -> ::c_int;
execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int695     pub fn execle(path: *const ::c_char,
696                   arg0: *const ::c_char, ...) -> ::c_int;
execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int697     pub fn execlp(file: *const ::c_char,
698                   arg0: *const ::c_char, ...) -> ::c_int;
execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int699     pub fn execv(prog: *const c_char,
700                  argv: *const *const c_char) -> ::c_int;
execve(prog: *const c_char, argv: *const *const c_char, envp: *const *const c_char) -> ::c_int701     pub fn execve(prog: *const c_char, argv: *const *const c_char,
702                   envp: *const *const c_char)
703                   -> ::c_int;
execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int704     pub fn execvp(c: *const c_char,
705                   argv: *const *const c_char) -> ::c_int;
fork() -> pid_t706     pub fn fork() -> pid_t;
fpathconf(filedes: ::c_int, name: ::c_int) -> c_long707     pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char708     pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
getegid() -> gid_t709     pub fn getegid() -> gid_t;
geteuid() -> uid_t710     pub fn geteuid() -> uid_t;
getgid() -> gid_t711     pub fn getgid() -> gid_t;
getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int712     pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t)
713                      -> ::c_int;
getlogin() -> *mut c_char714     pub fn getlogin() -> *mut c_char;
715     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
716                link_name = "getopt$UNIX2003")]
getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int717     pub fn getopt(argc: ::c_int, argv: *const *mut c_char,
718                   optstr: *const c_char) -> ::c_int;
getpgid(pid: pid_t) -> pid_t719     pub fn getpgid(pid: pid_t) -> pid_t;
getpgrp() -> pid_t720     pub fn getpgrp() -> pid_t;
getpid() -> pid_t721     pub fn getpid() -> pid_t;
getppid() -> pid_t722     pub fn getppid() -> pid_t;
getuid() -> uid_t723     pub fn getuid() -> uid_t;
isatty(fd: ::c_int) -> ::c_int724     pub fn isatty(fd: ::c_int) -> ::c_int;
link(src: *const c_char, dst: *const c_char) -> ::c_int725     pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t726     pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
pathconf(path: *const c_char, name: ::c_int) -> c_long727     pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
728     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
729                link_name = "pause$UNIX2003")]
pause() -> ::c_int730     pub fn pause() -> ::c_int;
pipe(fds: *mut ::c_int) -> ::c_int731     pub fn pipe(fds: *mut ::c_int) -> ::c_int;
posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int732     pub fn posix_memalign(memptr: *mut *mut ::c_void,
733                       align: ::size_t,
734                       size: ::size_t) -> ::c_int;
735     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
736                link_name = "read$UNIX2003")]
read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t737     pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
738                 -> ::ssize_t;
rmdir(path: *const c_char) -> ::c_int739     pub fn rmdir(path: *const c_char) -> ::c_int;
seteuid(uid: uid_t) -> ::c_int740     pub fn seteuid(uid: uid_t) -> ::c_int;
setegid(gid: gid_t) -> ::c_int741     pub fn setegid(gid: gid_t) -> ::c_int;
setgid(gid: gid_t) -> ::c_int742     pub fn setgid(gid: gid_t) -> ::c_int;
setpgid(pid: pid_t, pgid: pid_t) -> ::c_int743     pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
setsid() -> pid_t744     pub fn setsid() -> pid_t;
setuid(uid: uid_t) -> ::c_int745     pub fn setuid(uid: uid_t) -> ::c_int;
746     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
747                link_name = "sleep$UNIX2003")]
sleep(secs: ::c_uint) -> ::c_uint748     pub fn sleep(secs: ::c_uint) -> ::c_uint;
749     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
750                link_name = "nanosleep$UNIX2003")]
751     #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int752     pub fn nanosleep(rqtp: *const timespec,
753                      rmtp: *mut timespec) -> ::c_int;
tcgetpgrp(fd: ::c_int) -> pid_t754     pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int755     pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int;
ttyname(fd: ::c_int) -> *mut c_char756     pub fn ttyname(fd: ::c_int) -> *mut c_char;
757     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
758                link_name = "ttyname_r$UNIX2003")]
ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int759     pub fn ttyname_r(fd: ::c_int,
760                      buf: *mut c_char, buflen: ::size_t) -> ::c_int;
unlink(c: *const c_char) -> ::c_int761     pub fn unlink(c: *const c_char) -> ::c_int;
762     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
763                link_name = "wait$UNIX2003")]
wait(status: *mut ::c_int) -> pid_t764     pub fn wait(status: *mut ::c_int) -> pid_t;
765     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
766                link_name = "waitpid$UNIX2003")]
waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t767     pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int)
768                    -> pid_t;
769     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
770                link_name = "write$UNIX2003")]
write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t771     pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
772                  -> ::ssize_t;
773     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
774                link_name = "pread$UNIX2003")]
pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t775     pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
776                  offset: off_t) -> ::ssize_t;
777     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
778                link_name = "pwrite$UNIX2003")]
pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t779     pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
780                   offset: off_t) -> ::ssize_t;
umask(mask: mode_t) -> mode_t781     pub fn umask(mask: mode_t) -> mode_t;
782 
783     #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
utime(file: *const c_char, buf: *const utimbuf) -> ::c_int784     pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
785 
786     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
787                    link_name = "kill$UNIX2003")]
kill(pid: pid_t, sig: ::c_int) -> ::c_int788     pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
789     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
790                link_name = "killpg$UNIX2003")]
killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int791     pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int;
792 
mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int793     pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int794     pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
mlockall(flags: ::c_int) -> ::c_int795     pub fn mlockall(flags: ::c_int) -> ::c_int;
munlockall() -> ::c_int796     pub fn munlockall() -> ::c_int;
797 
798     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
799                link_name = "mmap$UNIX2003")]
mmap(addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t) -> *mut ::c_void800     pub fn mmap(addr: *mut ::c_void,
801                 len: ::size_t,
802                 prot: ::c_int,
803                 flags: ::c_int,
804                 fd: ::c_int,
805                 offset: off_t)
806                 -> *mut ::c_void;
807     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
808                link_name = "munmap$UNIX2003")]
munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int809     pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
810 
if_nametoindex(ifname: *const c_char) -> ::c_uint811     pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char812     pub fn if_indextoname(ifindex: ::c_uint,
813                           ifname: *mut ::c_char) -> *mut ::c_char;
814 
815     #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
816     #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
817     #[cfg_attr(
818         all(target_os = "freebsd", not(freebsd12)),
819         link_name = "lstat@FBSD_1.0"
820     )]
lstat(path: *const c_char, buf: *mut stat) -> ::c_int821     pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
822 
823     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
824                link_name = "fsync$UNIX2003")]
fsync(fd: ::c_int) -> ::c_int825     pub fn fsync(fd: ::c_int) -> ::c_int;
826 
827     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
828                link_name = "setenv$UNIX2003")]
setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int829     pub fn setenv(name: *const c_char, val: *const c_char,
830                   overwrite: ::c_int) -> ::c_int;
831     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
832                link_name = "unsetenv$UNIX2003")]
833     #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
unsetenv(name: *const c_char) -> ::c_int834     pub fn unsetenv(name: *const c_char) -> ::c_int;
835 
symlink(path1: *const c_char, path2: *const c_char) -> ::c_int836     pub fn symlink(path1: *const c_char,
837                    path2: *const c_char) -> ::c_int;
838 
truncate(path: *const c_char, length: off_t) -> ::c_int839     pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
ftruncate(fd: ::c_int, length: off_t) -> ::c_int840     pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
841 
signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t842     pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
843 
844     #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int845     pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
846 
847     #[cfg_attr(any(target_os = "macos", target_os = "ios"),
848                link_name = "realpath$DARWIN_EXTSN")]
realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char849     pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char)
850                     -> *mut ::c_char;
851 
flock(fd: ::c_int, operation: ::c_int) -> ::c_int852     pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
853 
854     #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
times(buf: *mut ::tms) -> ::clock_t855     pub fn times(buf: *mut ::tms) -> ::clock_t;
856 
pthread_self() -> ::pthread_t857     pub fn pthread_self() -> ::pthread_t;
858     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
859                link_name = "pthread_join$UNIX2003")]
pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int860     pub fn pthread_join(native: ::pthread_t,
861                         value: *mut *mut ::c_void) -> ::c_int;
pthread_exit(value: *mut ::c_void)862     pub fn pthread_exit(value: *mut ::c_void);
pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int863     pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int864     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_int865     pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t,
866                                      stack_size: ::size_t) -> ::c_int;
pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int867     pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t,
868                                        state: ::c_int) -> ::c_int;
pthread_detach(thread: ::pthread_t) -> ::c_int869     pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
870     #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
sched_yield() -> ::c_int871     pub fn sched_yield() -> ::c_int;
pthread_key_create(key: *mut pthread_key_t, dtor: ::Option<unsafe extern fn(*mut ::c_void)>) -> ::c_int872     pub fn pthread_key_create(key: *mut pthread_key_t,
873                               dtor: ::Option<unsafe extern fn(*mut ::c_void)>)
874                               -> ::c_int;
pthread_key_delete(key: pthread_key_t) -> ::c_int875     pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int;
pthread_getspecific(key: pthread_key_t) -> *mut ::c_void876     pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int877     pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void)
878                                -> ::c_int;
pthread_mutex_init(lock: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t) -> ::c_int879     pub fn pthread_mutex_init(lock: *mut pthread_mutex_t,
880                               attr: *const pthread_mutexattr_t) -> ::c_int;
pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int881     pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int882     pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int883     pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int884     pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
885 
pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int886     pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
887     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
888                link_name = "pthread_mutexattr_destroy$UNIX2003")]
pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int889     pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int890     pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t,
891                                      _type: ::c_int) -> ::c_int;
892 
893     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
894                link_name = "pthread_cond_init$UNIX2003")]
pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> ::c_int895     pub fn pthread_cond_init(cond: *mut pthread_cond_t,
896                              attr: *const pthread_condattr_t) -> ::c_int;
897     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
898                link_name = "pthread_cond_wait$UNIX2003")]
pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int899     pub fn pthread_cond_wait(cond: *mut pthread_cond_t,
900                              lock: *mut pthread_mutex_t) -> ::c_int;
901     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
902                link_name = "pthread_cond_timedwait$UNIX2003")]
pthread_cond_timedwait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, abstime: *const ::timespec) -> ::c_int903     pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t,
904                               lock: *mut pthread_mutex_t,
905                               abstime: *const ::timespec) -> ::c_int;
pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int906     pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int907     pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int908     pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int909     pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int910     pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
911     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
912                link_name = "pthread_rwlock_init$UNIX2003")]
pthread_rwlock_init(lock: *mut pthread_rwlock_t, attr: *const pthread_rwlockattr_t) -> ::c_int913     pub fn pthread_rwlock_init(lock: *mut pthread_rwlock_t,
914                                attr: *const pthread_rwlockattr_t) -> ::c_int;
915     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
916                link_name = "pthread_rwlock_destroy$UNIX2003")]
pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int917     pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
918     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
919                link_name = "pthread_rwlock_rdlock$UNIX2003")]
pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int920     pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
921     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
922                link_name = "pthread_rwlock_tryrdlock$UNIX2003")]
pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int923     pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
924     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
925                link_name = "pthread_rwlock_wrlock$UNIX2003")]
pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int926     pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
927     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
928                link_name = "pthread_rwlock_trywrlock$UNIX2003")]
pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int929     pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
930     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
931                link_name = "pthread_rwlock_unlock$UNIX2003")]
pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int932     pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int933     pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int934     pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t)
935                                       -> ::c_int;
936 
937     #[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_int938     pub fn getsockopt(sockfd: ::c_int,
939                       level: ::c_int,
940                       optname: ::c_int,
941                       optval: *mut ::c_void,
942                       optlen: *mut ::socklen_t) -> ::c_int;
raise(signum: ::c_int) -> ::c_int943     pub fn raise(signum: ::c_int) -> ::c_int;
944     #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int945     pub fn sigaction(signum: ::c_int,
946                      act: *const sigaction,
947                      oldact: *mut sigaction) -> ::c_int;
948 
949     #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int950     pub fn utimes(filename: *const ::c_char,
951                   times: *const ::timeval) -> ::c_int;
dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void952     pub fn dlopen(filename: *const ::c_char,
953                   flag: ::c_int) -> *mut ::c_void;
dlerror() -> *mut ::c_char954     pub fn dlerror() -> *mut ::c_char;
dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void955     pub fn dlsym(handle: *mut ::c_void,
956                  symbol: *const ::c_char) -> *mut ::c_void;
dlclose(handle: *mut ::c_void) -> ::c_int957     pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int958     pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
959 
getaddrinfo(node: *const c_char, service: *const c_char, hints: *const addrinfo, res: *mut *mut addrinfo) -> ::c_int960     pub fn getaddrinfo(node: *const c_char,
961                        service: *const c_char,
962                        hints: *const addrinfo,
963                        res: *mut *mut addrinfo) -> ::c_int;
freeaddrinfo(res: *mut addrinfo)964     pub fn freeaddrinfo(res: *mut addrinfo);
gai_strerror(errcode: ::c_int) -> *const ::c_char965     pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
966     #[cfg_attr(any(
967                    all(target_os = "linux", not(target_env = "musl")),
968                    target_os = "freebsd",
969                    target_os = "dragonfly",
970                    target_os = "haiku"),
971                link_name = "__res_init")]
972     #[cfg_attr(any(target_os = "macos", target_os = "ios"),
973                link_name = "res_9_init")]
res_init() -> ::c_int974     pub fn res_init() -> ::c_int;
975 
976     #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm977     pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
978     #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm979     pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
980     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
981                link_name = "mktime$UNIX2003")]
982     #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
mktime(tm: *mut tm) -> time_t983     pub fn mktime(tm: *mut tm) -> time_t;
984     #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
time(time: *mut time_t) -> time_t985     pub fn time(time: *mut time_t) -> time_t;
986     #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
gmtime(time_p: *const time_t) -> *mut tm987     pub fn gmtime(time_p: *const time_t) -> *mut tm;
988     #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
localtime(time_p: *const time_t) -> *mut tm989     pub fn localtime(time_p: *const time_t) -> *mut tm;
990     #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
difftime(time1: time_t, time0: time_t) -> ::c_double991     pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
992 
993     #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
994     #[cfg_attr(
995         all(target_os = "freebsd", not(freebsd12)),
996         link_name = "mknod@FBSD_1.0"
997     )]
mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int998     pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
999                  dev: ::dev_t) -> ::c_int;
gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1000     pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent1001     pub fn getservbyname(name: *const ::c_char,
1002                          proto: *const ::c_char) -> *mut servent;
getprotobyname(name: *const ::c_char) -> *mut protoent1003     pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
getprotobynumber(proto: ::c_int) -> *mut protoent1004     pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
chroot(name: *const ::c_char) -> ::c_int1005     pub fn chroot(name: *const ::c_char) -> ::c_int;
1006     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1007                link_name = "usleep$UNIX2003")]
usleep(secs: ::c_uint) -> ::c_int1008     pub fn usleep(secs: ::c_uint) -> ::c_int;
1009     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1010                link_name = "send$UNIX2003")]
send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1011     pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
1012                 flags: ::c_int) -> ::ssize_t;
1013     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1014                link_name = "recv$UNIX2003")]
recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1015     pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
1016                 flags: ::c_int) -> ::ssize_t;
1017     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1018                link_name = "putenv$UNIX2003")]
1019     #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
putenv(string: *mut c_char) -> ::c_int1020     pub fn putenv(string: *mut c_char) -> ::c_int;
1021     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1022                link_name = "poll$UNIX2003")]
poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1023     pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
1024     #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1025                link_name = "select$1050")]
1026     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1027                link_name = "select$UNIX2003")]
1028     #[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_int1029     pub fn select(nfds: ::c_int,
1030                   readfs: *mut fd_set,
1031                   writefds: *mut fd_set,
1032                   errorfds: *mut fd_set,
1033                   timeout: *mut timeval) -> ::c_int;
1034     #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char1035     pub fn setlocale(category: ::c_int,
1036                      locale: *const ::c_char) -> *mut ::c_char;
localeconv() -> *mut lconv1037     pub fn localeconv() -> *mut lconv;
1038 
1039     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1040                link_name = "sem_wait$UNIX2003")]
sem_wait(sem: *mut sem_t) -> ::c_int1041     pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
sem_trywait(sem: *mut sem_t) -> ::c_int1042     pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
sem_post(sem: *mut sem_t) -> ::c_int1043     pub fn sem_post(sem: *mut sem_t) -> ::c_int;
statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int1044     pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int1045     pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
1046 
readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t1047     pub fn readlink(path: *const c_char,
1048                     buf: *mut c_char,
1049                     bufsz: ::size_t)
1050                     -> ::ssize_t;
1051 
1052     #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
sigemptyset(set: *mut sigset_t) -> ::c_int1053     pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
1054     #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1055     pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1056     #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
sigfillset(set: *mut sigset_t) -> ::c_int1057     pub fn sigfillset(set: *mut sigset_t) -> ::c_int;
1058     #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1059     pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1060     #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int1061     pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
1062 
1063     #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1064     pub fn sigprocmask(how: ::c_int,
1065                        set: *const sigset_t,
1066                        oldset: *mut sigset_t)
1067                        -> ::c_int;
1068     #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
sigpending(set: *mut sigset_t) -> ::c_int1069     pub fn sigpending(set: *mut sigset_t) -> ::c_int;
1070 
1071     #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
timegm(tm: *mut ::tm) -> time_t1072     pub fn timegm(tm: *mut ::tm) -> time_t;
1073 
getsid(pid: pid_t) -> pid_t1074     pub fn getsid(pid: pid_t) -> pid_t;
1075 
sysconf(name: ::c_int) -> ::c_long1076     pub fn sysconf(name: ::c_int) -> ::c_long;
1077 
mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1078     pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
1079 
1080     #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1081                link_name = "pselect$1050")]
1082     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1083                link_name = "pselect$UNIX2003")]
1084     #[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_int1085     pub fn pselect(nfds: ::c_int,
1086                    readfs: *mut fd_set,
1087                    writefds: *mut fd_set,
1088                    errorfds: *mut fd_set,
1089                    timeout: *const timespec,
1090                    sigmask: *const sigset_t) -> ::c_int;
fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int1091     pub fn fseeko(stream: *mut ::FILE,
1092                   offset: ::off_t,
1093                   whence: ::c_int) -> ::c_int;
ftello(stream: *mut ::FILE) -> ::off_t1094     pub fn ftello(stream: *mut ::FILE) -> ::off_t;
1095     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1096                link_name = "tcdrain$UNIX2003")]
tcdrain(fd: ::c_int) -> ::c_int1097     pub fn tcdrain(fd: ::c_int) -> ::c_int;
cfgetispeed(termios: *const ::termios) -> ::speed_t1098     pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
cfgetospeed(termios: *const ::termios) -> ::speed_t1099     pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t;
cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1100     pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1101     pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int1102     pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int1103     pub fn tcsetattr(fd: ::c_int,
1104                      optional_actions: ::c_int,
1105                      termios: *const ::termios) -> ::c_int;
tcflow(fd: ::c_int, action: ::c_int) -> ::c_int1106     pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
tcflush(fd: ::c_int, action: ::c_int) -> ::c_int1107     pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
tcgetsid(fd: ::c_int) -> ::pid_t1108     pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int1109     pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
mkstemp(template: *mut ::c_char) -> ::c_int1110     pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
mkdtemp(template: *mut ::c_char) -> *mut ::c_char1111     pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
1112 
tmpnam(ptr: *mut ::c_char) -> *mut ::c_char1113     pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
1114 
openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int)1115     pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
closelog()1116     pub fn closelog();
setlogmask(maskpri: ::c_int) -> ::c_int1117     pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
1118     #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
syslog(priority: ::c_int, message: *const ::c_char, ...)1119     pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
1120     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1121                link_name = "nice$UNIX2003")]
nice(incr: ::c_int) -> ::c_int1122     pub fn nice(incr: ::c_int) -> ::c_int;
1123 
grantpt(fd: ::c_int) -> ::c_int1124     pub fn grantpt(fd: ::c_int) -> ::c_int;
posix_openpt(flags: ::c_int) -> ::c_int1125     pub fn posix_openpt(flags: ::c_int) -> ::c_int;
ptsname(fd: ::c_int) -> *mut ::c_char1126     pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
unlockpt(fd: ::c_int) -> ::c_int1127     pub fn unlockpt(fd: ::c_int) -> ::c_int;
1128 
strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char1129     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_t1130     pub fn getline (lineptr: *mut *mut c_char, n: *mut size_t,
1131         stream: *mut FILE) -> ssize_t;
1132 }
1133 
1134 cfg_if! {
1135    if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] {
1136         extern {
1137             pub fn cfmakeraw(termios: *mut ::termios);
1138             pub fn cfsetspeed(termios: *mut ::termios,
1139                               speed: ::speed_t) -> ::c_int;
1140         }
1141    }
1142 }
1143 
1144 cfg_if! {
1145     if #[cfg(target_env = "uclibc")] {
1146         mod uclibc;
1147         pub use self::uclibc::*;
1148     } else if #[cfg(target_env = "newlib")] {
1149         mod newlib;
1150         pub use self::newlib::*;
1151     } else if #[cfg(any(target_os = "linux",
1152                         target_os = "android",
1153                         target_os = "emscripten"))] {
1154         mod linux_like;
1155         pub use self::linux_like::*;
1156     } else if #[cfg(any(target_os = "macos",
1157                         target_os = "ios",
1158                         target_os = "freebsd",
1159                         target_os = "dragonfly",
1160                         target_os = "openbsd",
1161                         target_os = "netbsd"))] {
1162         mod bsd;
1163         pub use self::bsd::*;
1164     } else if #[cfg(any(target_os = "solaris",
1165                         target_os = "illumos"))] {
1166         mod solarish;
1167         pub use self::solarish::*;
1168     } else if #[cfg(target_os = "haiku")] {
1169         mod haiku;
1170         pub use self::haiku::*;
1171     } else if #[cfg(target_os = "hermit")] {
1172         mod hermit;
1173         pub use self::hermit::*;
1174     } else if #[cfg(target_os = "redox")] {
1175         mod redox;
1176         pub use self::redox::*;
1177     } else {
1178         // Unknown target_os
1179     }
1180 }
1181 
1182 cfg_if! {
1183     if #[cfg(libc_core_cvoid)] {
1184         pub use ::ffi::c_void;
1185     } else {
1186         // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
1187         // enable more optimization opportunities around it recognizing things
1188         // like malloc/free.
1189         #[repr(u8)]
1190         #[allow(missing_copy_implementations)]
1191         #[allow(missing_debug_implementations)]
1192         pub enum c_void {
1193             // Two dummy variants so the #[repr] attribute can be used.
1194             #[doc(hidden)]
1195             __variant1,
1196             #[doc(hidden)]
1197             __variant2,
1198         }
1199     }
1200 }
1201 
1202 cfg_if! {
1203     if #[cfg(libc_align)] {
1204         mod align;
1205         pub use self::align::*;
1206     } else {
1207         mod no_align;
1208         pub use self::no_align::*;
1209     }
1210 }
1211