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;
unlink(c: *const c_char) -> ::c_int757     pub fn unlink(c: *const c_char) -> ::c_int;
758     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
759                link_name = "wait$UNIX2003")]
wait(status: *mut ::c_int) -> pid_t760     pub fn wait(status: *mut ::c_int) -> pid_t;
761     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
762                link_name = "waitpid$UNIX2003")]
waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t763     pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int)
764                    -> pid_t;
765     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
766                link_name = "write$UNIX2003")]
write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t767     pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
768                  -> ::ssize_t;
769     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
770                link_name = "pread$UNIX2003")]
pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t771     pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
772                  offset: off_t) -> ::ssize_t;
773     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
774                link_name = "pwrite$UNIX2003")]
pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t775     pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
776                   offset: off_t) -> ::ssize_t;
umask(mask: mode_t) -> mode_t777     pub fn umask(mask: mode_t) -> mode_t;
778 
779     #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
utime(file: *const c_char, buf: *const utimbuf) -> ::c_int780     pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
781 
782     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
783                    link_name = "kill$UNIX2003")]
kill(pid: pid_t, sig: ::c_int) -> ::c_int784     pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
785     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
786                link_name = "killpg$UNIX2003")]
killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int787     pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int;
788 
mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int789     pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int790     pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
mlockall(flags: ::c_int) -> ::c_int791     pub fn mlockall(flags: ::c_int) -> ::c_int;
munlockall() -> ::c_int792     pub fn munlockall() -> ::c_int;
793 
794     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
795                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_void796     pub fn mmap(addr: *mut ::c_void,
797                 len: ::size_t,
798                 prot: ::c_int,
799                 flags: ::c_int,
800                 fd: ::c_int,
801                 offset: off_t)
802                 -> *mut ::c_void;
803     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
804                link_name = "munmap$UNIX2003")]
munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int805     pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
806 
if_nametoindex(ifname: *const c_char) -> ::c_uint807     pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char808     pub fn if_indextoname(ifindex: ::c_uint,
809                           ifname: *mut ::c_char) -> *mut ::c_char;
810 
811     #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
812     #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
813     #[cfg_attr(
814         all(target_os = "freebsd", not(freebsd12)),
815         link_name = "lstat@FBSD_1.0"
816     )]
lstat(path: *const c_char, buf: *mut stat) -> ::c_int817     pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
818 
819     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
820                link_name = "fsync$UNIX2003")]
fsync(fd: ::c_int) -> ::c_int821     pub fn fsync(fd: ::c_int) -> ::c_int;
822 
823     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
824                link_name = "setenv$UNIX2003")]
setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int825     pub fn setenv(name: *const c_char, val: *const c_char,
826                   overwrite: ::c_int) -> ::c_int;
827     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
828                link_name = "unsetenv$UNIX2003")]
829     #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
unsetenv(name: *const c_char) -> ::c_int830     pub fn unsetenv(name: *const c_char) -> ::c_int;
831 
symlink(path1: *const c_char, path2: *const c_char) -> ::c_int832     pub fn symlink(path1: *const c_char,
833                    path2: *const c_char) -> ::c_int;
834 
truncate(path: *const c_char, length: off_t) -> ::c_int835     pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
ftruncate(fd: ::c_int, length: off_t) -> ::c_int836     pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
837 
signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t838     pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
839 
840     #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int841     pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
842 
843     #[cfg_attr(any(target_os = "macos", target_os = "ios"),
844                link_name = "realpath$DARWIN_EXTSN")]
realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char845     pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char)
846                     -> *mut ::c_char;
847 
flock(fd: ::c_int, operation: ::c_int) -> ::c_int848     pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
849 
850     #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
times(buf: *mut ::tms) -> ::clock_t851     pub fn times(buf: *mut ::tms) -> ::clock_t;
852 
pthread_self() -> ::pthread_t853     pub fn pthread_self() -> ::pthread_t;
854     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
855                link_name = "pthread_join$UNIX2003")]
pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int856     pub fn pthread_join(native: ::pthread_t,
857                         value: *mut *mut ::c_void) -> ::c_int;
pthread_exit(value: *mut ::c_void)858     pub fn pthread_exit(value: *mut ::c_void);
pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int859     pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int860     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_int861     pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t,
862                                      stack_size: ::size_t) -> ::c_int;
pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int863     pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t,
864                                        state: ::c_int) -> ::c_int;
pthread_detach(thread: ::pthread_t) -> ::c_int865     pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
866     #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
sched_yield() -> ::c_int867     pub fn sched_yield() -> ::c_int;
pthread_key_create(key: *mut pthread_key_t, dtor: ::Option<unsafe extern fn(*mut ::c_void)>) -> ::c_int868     pub fn pthread_key_create(key: *mut pthread_key_t,
869                               dtor: ::Option<unsafe extern fn(*mut ::c_void)>)
870                               -> ::c_int;
pthread_key_delete(key: pthread_key_t) -> ::c_int871     pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int;
pthread_getspecific(key: pthread_key_t) -> *mut ::c_void872     pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int873     pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void)
874                                -> ::c_int;
pthread_mutex_init(lock: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t) -> ::c_int875     pub fn pthread_mutex_init(lock: *mut pthread_mutex_t,
876                               attr: *const pthread_mutexattr_t) -> ::c_int;
pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int877     pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int878     pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int879     pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int;
pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int880     pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
881 
pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int882     pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
883     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
884                link_name = "pthread_mutexattr_destroy$UNIX2003")]
pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int885     pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int886     pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t,
887                                      _type: ::c_int) -> ::c_int;
888 
889     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
890                link_name = "pthread_cond_init$UNIX2003")]
pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> ::c_int891     pub fn pthread_cond_init(cond: *mut pthread_cond_t,
892                              attr: *const pthread_condattr_t) -> ::c_int;
893     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
894                link_name = "pthread_cond_wait$UNIX2003")]
pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int895     pub fn pthread_cond_wait(cond: *mut pthread_cond_t,
896                              lock: *mut pthread_mutex_t) -> ::c_int;
897     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
898                link_name = "pthread_cond_timedwait$UNIX2003")]
pthread_cond_timedwait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, abstime: *const ::timespec) -> ::c_int899     pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t,
900                               lock: *mut pthread_mutex_t,
901                               abstime: *const ::timespec) -> ::c_int;
pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int902     pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int903     pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int904     pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int905     pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int906     pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
907     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
908                link_name = "pthread_rwlock_init$UNIX2003")]
pthread_rwlock_init(lock: *mut pthread_rwlock_t, attr: *const pthread_rwlockattr_t) -> ::c_int909     pub fn pthread_rwlock_init(lock: *mut pthread_rwlock_t,
910                                attr: *const pthread_rwlockattr_t) -> ::c_int;
911     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
912                link_name = "pthread_rwlock_destroy$UNIX2003")]
pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int913     pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
914     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
915                link_name = "pthread_rwlock_rdlock$UNIX2003")]
pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int916     pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
917     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
918                link_name = "pthread_rwlock_tryrdlock$UNIX2003")]
pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int919     pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
920     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
921                link_name = "pthread_rwlock_wrlock$UNIX2003")]
pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int922     pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
923     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
924                link_name = "pthread_rwlock_trywrlock$UNIX2003")]
pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int925     pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
926     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
927                link_name = "pthread_rwlock_unlock$UNIX2003")]
pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int928     pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int929     pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int930     pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t)
931                                       -> ::c_int;
932 
933     #[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_int934     pub fn getsockopt(sockfd: ::c_int,
935                       level: ::c_int,
936                       optname: ::c_int,
937                       optval: *mut ::c_void,
938                       optlen: *mut ::socklen_t) -> ::c_int;
raise(signum: ::c_int) -> ::c_int939     pub fn raise(signum: ::c_int) -> ::c_int;
940     #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int941     pub fn sigaction(signum: ::c_int,
942                      act: *const sigaction,
943                      oldact: *mut sigaction) -> ::c_int;
944 
945     #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int946     pub fn utimes(filename: *const ::c_char,
947                   times: *const ::timeval) -> ::c_int;
dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void948     pub fn dlopen(filename: *const ::c_char,
949                   flag: ::c_int) -> *mut ::c_void;
dlerror() -> *mut ::c_char950     pub fn dlerror() -> *mut ::c_char;
dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void951     pub fn dlsym(handle: *mut ::c_void,
952                  symbol: *const ::c_char) -> *mut ::c_void;
dlclose(handle: *mut ::c_void) -> ::c_int953     pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int954     pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
955 
getaddrinfo(node: *const c_char, service: *const c_char, hints: *const addrinfo, res: *mut *mut addrinfo) -> ::c_int956     pub fn getaddrinfo(node: *const c_char,
957                        service: *const c_char,
958                        hints: *const addrinfo,
959                        res: *mut *mut addrinfo) -> ::c_int;
freeaddrinfo(res: *mut addrinfo)960     pub fn freeaddrinfo(res: *mut addrinfo);
gai_strerror(errcode: ::c_int) -> *const ::c_char961     pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
962     #[cfg_attr(any(
963                    all(target_os = "linux", not(target_env = "musl")),
964                    target_os = "freebsd",
965                    target_os = "dragonfly",
966                    target_os = "haiku"),
967                link_name = "__res_init")]
968     #[cfg_attr(any(target_os = "macos", target_os = "ios"),
969                link_name = "res_9_init")]
res_init() -> ::c_int970     pub fn res_init() -> ::c_int;
971 
972     #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm973     pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
974     #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm975     pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
976     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
977                link_name = "mktime$UNIX2003")]
978     #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
mktime(tm: *mut tm) -> time_t979     pub fn mktime(tm: *mut tm) -> time_t;
980     #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
time(time: *mut time_t) -> time_t981     pub fn time(time: *mut time_t) -> time_t;
982     #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
gmtime(time_p: *const time_t) -> *mut tm983     pub fn gmtime(time_p: *const time_t) -> *mut tm;
984     #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
localtime(time_p: *const time_t) -> *mut tm985     pub fn localtime(time_p: *const time_t) -> *mut tm;
986     #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
difftime(time1: time_t, time0: time_t) -> ::c_double987     pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
988 
989     #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
990     #[cfg_attr(
991         all(target_os = "freebsd", not(freebsd12)),
992         link_name = "mknod@FBSD_1.0"
993     )]
mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int994     pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
995                  dev: ::dev_t) -> ::c_int;
gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int996     pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent997     pub fn getservbyname(name: *const ::c_char,
998                          proto: *const ::c_char) -> *mut servent;
getprotobyname(name: *const ::c_char) -> *mut protoent999     pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
getprotobynumber(proto: ::c_int) -> *mut protoent1000     pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
chroot(name: *const ::c_char) -> ::c_int1001     pub fn chroot(name: *const ::c_char) -> ::c_int;
1002     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1003                link_name = "usleep$UNIX2003")]
usleep(secs: ::c_uint) -> ::c_int1004     pub fn usleep(secs: ::c_uint) -> ::c_int;
1005     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1006                link_name = "send$UNIX2003")]
send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1007     pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
1008                 flags: ::c_int) -> ::ssize_t;
1009     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1010                link_name = "recv$UNIX2003")]
recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1011     pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
1012                 flags: ::c_int) -> ::ssize_t;
1013     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1014                link_name = "putenv$UNIX2003")]
1015     #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
putenv(string: *mut c_char) -> ::c_int1016     pub fn putenv(string: *mut c_char) -> ::c_int;
1017     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1018                link_name = "poll$UNIX2003")]
poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1019     pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
1020     #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1021                link_name = "select$1050")]
1022     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1023                link_name = "select$UNIX2003")]
1024     #[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_int1025     pub fn select(nfds: ::c_int,
1026                   readfs: *mut fd_set,
1027                   writefds: *mut fd_set,
1028                   errorfds: *mut fd_set,
1029                   timeout: *mut timeval) -> ::c_int;
1030     #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char1031     pub fn setlocale(category: ::c_int,
1032                      locale: *const ::c_char) -> *mut ::c_char;
localeconv() -> *mut lconv1033     pub fn localeconv() -> *mut lconv;
1034 
1035     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1036                link_name = "sem_wait$UNIX2003")]
sem_wait(sem: *mut sem_t) -> ::c_int1037     pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
sem_trywait(sem: *mut sem_t) -> ::c_int1038     pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
sem_post(sem: *mut sem_t) -> ::c_int1039     pub fn sem_post(sem: *mut sem_t) -> ::c_int;
statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int1040     pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int1041     pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
1042 
readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t1043     pub fn readlink(path: *const c_char,
1044                     buf: *mut c_char,
1045                     bufsz: ::size_t)
1046                     -> ::ssize_t;
1047 
1048     #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
sigemptyset(set: *mut sigset_t) -> ::c_int1049     pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
1050     #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1051     pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1052     #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
sigfillset(set: *mut sigset_t) -> ::c_int1053     pub fn sigfillset(set: *mut sigset_t) -> ::c_int;
1054     #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1055     pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1056     #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int1057     pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
1058 
1059     #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1060     pub fn sigprocmask(how: ::c_int,
1061                        set: *const sigset_t,
1062                        oldset: *mut sigset_t)
1063                        -> ::c_int;
1064     #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
sigpending(set: *mut sigset_t) -> ::c_int1065     pub fn sigpending(set: *mut sigset_t) -> ::c_int;
1066 
1067     #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
timegm(tm: *mut ::tm) -> time_t1068     pub fn timegm(tm: *mut ::tm) -> time_t;
1069 
getsid(pid: pid_t) -> pid_t1070     pub fn getsid(pid: pid_t) -> pid_t;
1071 
sysconf(name: ::c_int) -> ::c_long1072     pub fn sysconf(name: ::c_int) -> ::c_long;
1073 
mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1074     pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
1075 
1076     #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1077                link_name = "pselect$1050")]
1078     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1079                link_name = "pselect$UNIX2003")]
1080     #[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_int1081     pub fn pselect(nfds: ::c_int,
1082                    readfs: *mut fd_set,
1083                    writefds: *mut fd_set,
1084                    errorfds: *mut fd_set,
1085                    timeout: *const timespec,
1086                    sigmask: *const sigset_t) -> ::c_int;
fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int1087     pub fn fseeko(stream: *mut ::FILE,
1088                   offset: ::off_t,
1089                   whence: ::c_int) -> ::c_int;
ftello(stream: *mut ::FILE) -> ::off_t1090     pub fn ftello(stream: *mut ::FILE) -> ::off_t;
1091     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1092                link_name = "tcdrain$UNIX2003")]
tcdrain(fd: ::c_int) -> ::c_int1093     pub fn tcdrain(fd: ::c_int) -> ::c_int;
cfgetispeed(termios: *const ::termios) -> ::speed_t1094     pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
cfgetospeed(termios: *const ::termios) -> ::speed_t1095     pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t;
cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1096     pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1097     pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int1098     pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int1099     pub fn tcsetattr(fd: ::c_int,
1100                      optional_actions: ::c_int,
1101                      termios: *const ::termios) -> ::c_int;
tcflow(fd: ::c_int, action: ::c_int) -> ::c_int1102     pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
tcflush(fd: ::c_int, action: ::c_int) -> ::c_int1103     pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
tcgetsid(fd: ::c_int) -> ::pid_t1104     pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int1105     pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
mkstemp(template: *mut ::c_char) -> ::c_int1106     pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
mkdtemp(template: *mut ::c_char) -> *mut ::c_char1107     pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
1108 
tmpnam(ptr: *mut ::c_char) -> *mut ::c_char1109     pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
1110 
openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int)1111     pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
closelog()1112     pub fn closelog();
setlogmask(maskpri: ::c_int) -> ::c_int1113     pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
1114     #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
syslog(priority: ::c_int, message: *const ::c_char, ...)1115     pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
1116     #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1117                link_name = "nice$UNIX2003")]
nice(incr: ::c_int) -> ::c_int1118     pub fn nice(incr: ::c_int) -> ::c_int;
1119 
grantpt(fd: ::c_int) -> ::c_int1120     pub fn grantpt(fd: ::c_int) -> ::c_int;
posix_openpt(flags: ::c_int) -> ::c_int1121     pub fn posix_openpt(flags: ::c_int) -> ::c_int;
ptsname(fd: ::c_int) -> *mut ::c_char1122     pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
unlockpt(fd: ::c_int) -> ::c_int1123     pub fn unlockpt(fd: ::c_int) -> ::c_int;
1124 
strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char1125     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_t1126     pub fn getline (lineptr: *mut *mut c_char, n: *mut size_t,
1127         stream: *mut FILE) -> ssize_t;
1128 }
1129 
1130 cfg_if! {
1131    if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] {
1132         extern {
1133             pub fn cfmakeraw(termios: *mut ::termios);
1134             pub fn cfsetspeed(termios: *mut ::termios,
1135                               speed: ::speed_t) -> ::c_int;
1136         }
1137    }
1138 }
1139 
1140 cfg_if! {
1141     if #[cfg(target_env = "uclibc")] {
1142         mod uclibc;
1143         pub use self::uclibc::*;
1144     } else if #[cfg(target_env = "newlib")] {
1145         mod newlib;
1146         pub use self::newlib::*;
1147     } else if #[cfg(any(target_os = "linux",
1148                         target_os = "android",
1149                         target_os = "emscripten"))] {
1150         mod notbsd;
1151         pub use self::notbsd::*;
1152     } else if #[cfg(any(target_os = "macos",
1153                         target_os = "ios",
1154                         target_os = "freebsd",
1155                         target_os = "dragonfly",
1156                         target_os = "openbsd",
1157                         target_os = "netbsd"))] {
1158         mod bsd;
1159         pub use self::bsd::*;
1160     } else if #[cfg(any(target_os = "solaris",
1161                         target_os = "illumos"))] {
1162         mod solarish;
1163         pub use self::solarish::*;
1164     } else if #[cfg(target_os = "haiku")] {
1165         mod haiku;
1166         pub use self::haiku::*;
1167     } else if #[cfg(target_os = "hermit")] {
1168         mod hermit;
1169         pub use self::hermit::*;
1170     } else if #[cfg(target_os = "redox")] {
1171         mod redox;
1172         pub use self::redox::*;
1173     } else {
1174         // Unknown target_os
1175     }
1176 }
1177 
1178 cfg_if! {
1179     if #[cfg(libc_core_cvoid)] {
1180         pub use ::ffi::c_void;
1181     } else {
1182         // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
1183         // enable more optimization opportunities around it recognizing things
1184         // like malloc/free.
1185         #[repr(u8)]
1186         #[allow(missing_copy_implementations)]
1187         #[allow(missing_debug_implementations)]
1188         pub enum c_void {
1189             // Two dummy variants so the #[repr] attribute can be used.
1190             #[doc(hidden)]
1191             __variant1,
1192             #[doc(hidden)]
1193             __variant2,
1194         }
1195     }
1196 }
1197 
1198 cfg_if! {
1199     if #[cfg(libc_align)] {
1200         mod align;
1201         pub use self::align::*;
1202     } else {
1203         mod no_align;
1204         pub use self::no_align::*;
1205     }
1206 }
1207