]> git.proxmox.com Git - rustc.git/blob - vendor/libc/src/unix/mod.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / vendor / libc / src / unix / mod.rs
1 //! Definitions found commonly among almost all Unix derivatives
2 //!
3 //! More functions and definitions can be found in the more specific modules
4 //! according to the platform in question.
5
6 pub type c_schar = i8;
7 pub type c_uchar = u8;
8 pub type c_short = i16;
9 pub type c_ushort = u16;
10 pub type c_int = i32;
11 pub type c_uint = u32;
12 pub type c_float = f32;
13 pub type c_double = f64;
14 pub type c_longlong = i64;
15 pub type c_ulonglong = u64;
16 pub type intmax_t = i64;
17 pub type uintmax_t = u64;
18
19 pub type size_t = usize;
20 pub type ptrdiff_t = isize;
21 pub type intptr_t = isize;
22 pub type uintptr_t = usize;
23 pub type ssize_t = isize;
24
25 pub type pid_t = i32;
26 pub type in_addr_t = u32;
27 pub type in_port_t = u16;
28 pub type sighandler_t = ::size_t;
29 pub type cc_t = ::c_uchar;
30
31 cfg_if! {
32 if #[cfg(any(target_os = "espidf", target_os = "horizon"))] {
33 pub type uid_t = ::c_ushort;
34 pub type gid_t = ::c_ushort;
35 } else {
36 pub type uid_t = u32;
37 pub type gid_t = u32;
38 }
39 }
40
41 #[cfg_attr(feature = "extra_traits", derive(Debug))]
42 pub enum DIR {}
43 impl ::Copy for DIR {}
44 impl ::Clone for DIR {
45 fn clone(&self) -> DIR {
46 *self
47 }
48 }
49 pub type locale_t = *mut ::c_void;
50
51 s! {
52 pub struct group {
53 pub gr_name: *mut ::c_char,
54 pub gr_passwd: *mut ::c_char,
55 pub gr_gid: ::gid_t,
56 pub gr_mem: *mut *mut ::c_char,
57 }
58
59 pub struct utimbuf {
60 pub actime: time_t,
61 pub modtime: time_t,
62 }
63
64 pub struct timeval {
65 pub tv_sec: time_t,
66 pub tv_usec: suseconds_t,
67 }
68
69 // linux x32 compatibility
70 // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
71 pub struct timespec {
72 pub tv_sec: time_t,
73 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
74 pub tv_nsec: i64,
75 #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
76 pub tv_nsec: ::c_long,
77 }
78
79 pub struct rlimit {
80 pub rlim_cur: rlim_t,
81 pub rlim_max: rlim_t,
82 }
83
84 pub struct rusage {
85 pub ru_utime: timeval,
86 pub ru_stime: timeval,
87 pub ru_maxrss: c_long,
88 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
89 __pad1: u32,
90 pub ru_ixrss: c_long,
91 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
92 __pad2: u32,
93 pub ru_idrss: c_long,
94 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
95 __pad3: u32,
96 pub ru_isrss: c_long,
97 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
98 __pad4: u32,
99 pub ru_minflt: c_long,
100 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
101 __pad5: u32,
102 pub ru_majflt: c_long,
103 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
104 __pad6: u32,
105 pub ru_nswap: c_long,
106 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
107 __pad7: u32,
108 pub ru_inblock: c_long,
109 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
110 __pad8: u32,
111 pub ru_oublock: c_long,
112 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
113 __pad9: u32,
114 pub ru_msgsnd: c_long,
115 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
116 __pad10: u32,
117 pub ru_msgrcv: c_long,
118 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
119 __pad11: u32,
120 pub ru_nsignals: c_long,
121 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
122 __pad12: u32,
123 pub ru_nvcsw: c_long,
124 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
125 __pad13: u32,
126 pub ru_nivcsw: c_long,
127 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
128 __pad14: u32,
129
130 #[cfg(any(target_env = "musl", target_os = "emscripten"))]
131 __reserved: [c_long; 16],
132 }
133
134 pub struct ipv6_mreq {
135 pub ipv6mr_multiaddr: in6_addr,
136 #[cfg(target_os = "android")]
137 pub ipv6mr_interface: ::c_int,
138 #[cfg(not(target_os = "android"))]
139 pub ipv6mr_interface: ::c_uint,
140 }
141
142 pub struct hostent {
143 pub h_name: *mut ::c_char,
144 pub h_aliases: *mut *mut ::c_char,
145 pub h_addrtype: ::c_int,
146 pub h_length: ::c_int,
147 pub h_addr_list: *mut *mut ::c_char,
148 }
149
150 pub struct iovec {
151 pub iov_base: *mut ::c_void,
152 pub iov_len: ::size_t,
153 }
154
155 pub struct pollfd {
156 pub fd: ::c_int,
157 pub events: ::c_short,
158 pub revents: ::c_short,
159 }
160
161 pub struct winsize {
162 pub ws_row: ::c_ushort,
163 pub ws_col: ::c_ushort,
164 pub ws_xpixel: ::c_ushort,
165 pub ws_ypixel: ::c_ushort,
166 }
167
168 pub struct linger {
169 pub l_onoff: ::c_int,
170 pub l_linger: ::c_int,
171 }
172
173 pub struct sigval {
174 // Actually a union of an int and a void*
175 pub sival_ptr: *mut ::c_void
176 }
177
178 // <sys/time.h>
179 pub struct itimerval {
180 pub it_interval: ::timeval,
181 pub it_value: ::timeval,
182 }
183
184 // <sys/times.h>
185 pub struct tms {
186 pub tms_utime: ::clock_t,
187 pub tms_stime: ::clock_t,
188 pub tms_cutime: ::clock_t,
189 pub tms_cstime: ::clock_t,
190 }
191
192 pub struct servent {
193 pub s_name: *mut ::c_char,
194 pub s_aliases: *mut *mut ::c_char,
195 pub s_port: ::c_int,
196 pub s_proto: *mut ::c_char,
197 }
198
199 pub struct protoent {
200 pub p_name: *mut ::c_char,
201 pub p_aliases: *mut *mut ::c_char,
202 pub p_proto: ::c_int,
203 }
204 }
205
206 pub const INT_MIN: c_int = -2147483648;
207 pub const INT_MAX: c_int = 2147483647;
208
209 pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
210 pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
211 pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
212
213 pub const DT_UNKNOWN: u8 = 0;
214 pub const DT_FIFO: u8 = 1;
215 pub const DT_CHR: u8 = 2;
216 pub const DT_DIR: u8 = 4;
217 pub const DT_BLK: u8 = 6;
218 pub const DT_REG: u8 = 8;
219 pub const DT_LNK: u8 = 10;
220 pub const DT_SOCK: u8 = 12;
221
222 cfg_if! {
223 if #[cfg(not(target_os = "redox"))] {
224 pub const FD_CLOEXEC: ::c_int = 0x1;
225 }
226 }
227
228 pub const USRQUOTA: ::c_int = 0;
229 pub const GRPQUOTA: ::c_int = 1;
230
231 pub const SIGIOT: ::c_int = 6;
232
233 pub const S_ISUID: ::mode_t = 0x800;
234 pub const S_ISGID: ::mode_t = 0x400;
235 pub const S_ISVTX: ::mode_t = 0x200;
236
237 cfg_if! {
238 if #[cfg(not(any(target_os = "haiku", target_os = "illumos",
239 target_os = "solaris")))] {
240 pub const IF_NAMESIZE: ::size_t = 16;
241 pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
242 }
243 }
244
245 pub const LOG_EMERG: ::c_int = 0;
246 pub const LOG_ALERT: ::c_int = 1;
247 pub const LOG_CRIT: ::c_int = 2;
248 pub const LOG_ERR: ::c_int = 3;
249 pub const LOG_WARNING: ::c_int = 4;
250 pub const LOG_NOTICE: ::c_int = 5;
251 pub const LOG_INFO: ::c_int = 6;
252 pub const LOG_DEBUG: ::c_int = 7;
253
254 pub const LOG_KERN: ::c_int = 0;
255 pub const LOG_USER: ::c_int = 1 << 3;
256 pub const LOG_MAIL: ::c_int = 2 << 3;
257 pub const LOG_DAEMON: ::c_int = 3 << 3;
258 pub const LOG_AUTH: ::c_int = 4 << 3;
259 pub const LOG_SYSLOG: ::c_int = 5 << 3;
260 pub const LOG_LPR: ::c_int = 6 << 3;
261 pub const LOG_NEWS: ::c_int = 7 << 3;
262 pub const LOG_UUCP: ::c_int = 8 << 3;
263 pub const LOG_LOCAL0: ::c_int = 16 << 3;
264 pub const LOG_LOCAL1: ::c_int = 17 << 3;
265 pub const LOG_LOCAL2: ::c_int = 18 << 3;
266 pub const LOG_LOCAL3: ::c_int = 19 << 3;
267 pub const LOG_LOCAL4: ::c_int = 20 << 3;
268 pub const LOG_LOCAL5: ::c_int = 21 << 3;
269 pub const LOG_LOCAL6: ::c_int = 22 << 3;
270 pub const LOG_LOCAL7: ::c_int = 23 << 3;
271
272 cfg_if! {
273 if #[cfg(not(target_os = "haiku"))] {
274 pub const LOG_PID: ::c_int = 0x01;
275 pub const LOG_CONS: ::c_int = 0x02;
276 pub const LOG_ODELAY: ::c_int = 0x04;
277 pub const LOG_NDELAY: ::c_int = 0x08;
278 pub const LOG_NOWAIT: ::c_int = 0x10;
279 }
280 }
281 pub const LOG_PRIMASK: ::c_int = 7;
282 pub const LOG_FACMASK: ::c_int = 0x3f8;
283
284 pub const PRIO_MIN: ::c_int = -20;
285 pub const PRIO_MAX: ::c_int = 20;
286
287 pub const IPPROTO_ICMP: ::c_int = 1;
288 pub const IPPROTO_ICMPV6: ::c_int = 58;
289 pub const IPPROTO_TCP: ::c_int = 6;
290 pub const IPPROTO_UDP: ::c_int = 17;
291 pub const IPPROTO_IP: ::c_int = 0;
292 pub const IPPROTO_IPV6: ::c_int = 41;
293
294 pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
295 pub const INADDR_ANY: in_addr_t = 0;
296 pub const INADDR_BROADCAST: in_addr_t = 4294967295;
297 pub const INADDR_NONE: in_addr_t = 4294967295;
298
299 pub const ARPOP_REQUEST: u16 = 1;
300 pub const ARPOP_REPLY: u16 = 2;
301
302 pub const ATF_COM: ::c_int = 0x02;
303 pub const ATF_PERM: ::c_int = 0x04;
304 pub const ATF_PUBL: ::c_int = 0x08;
305 pub const ATF_USETRAILERS: ::c_int = 0x10;
306
307 cfg_if! {
308 if #[cfg(any(target_os = "l4re", target_os = "espidf"))] {
309 // required libraries for L4Re and the ESP-IDF framework are linked externally, ATM
310 } else if #[cfg(feature = "std")] {
311 // cargo build, don't pull in anything extra as the libstd dep
312 // already pulls in all libs.
313 } else if #[cfg(all(target_os = "linux",
314 any(target_env = "gnu", target_env = "uclibc"),
315 feature = "rustc-dep-of-std"))] {
316 #[link(name = "util", kind = "static", modifiers = "-bundle",
317 cfg(target_feature = "crt-static"))]
318 #[link(name = "rt", kind = "static", modifiers = "-bundle",
319 cfg(target_feature = "crt-static"))]
320 #[link(name = "pthread", kind = "static", modifiers = "-bundle",
321 cfg(target_feature = "crt-static"))]
322 #[link(name = "m", kind = "static", modifiers = "-bundle",
323 cfg(target_feature = "crt-static"))]
324 #[link(name = "dl", kind = "static", modifiers = "-bundle",
325 cfg(target_feature = "crt-static"))]
326 #[link(name = "c", kind = "static", modifiers = "-bundle",
327 cfg(target_feature = "crt-static"))]
328 #[link(name = "gcc_eh", kind = "static", modifiers = "-bundle",
329 cfg(target_feature = "crt-static"))]
330 #[link(name = "gcc", kind = "static", modifiers = "-bundle",
331 cfg(target_feature = "crt-static"))]
332 #[link(name = "util", cfg(not(target_feature = "crt-static")))]
333 #[link(name = "rt", cfg(not(target_feature = "crt-static")))]
334 #[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
335 #[link(name = "m", cfg(not(target_feature = "crt-static")))]
336 #[link(name = "dl", cfg(not(target_feature = "crt-static")))]
337 #[link(name = "c", cfg(not(target_feature = "crt-static")))]
338 extern {}
339 } else if #[cfg(target_env = "musl")] {
340 #[cfg_attr(feature = "rustc-dep-of-std",
341 link(name = "c", kind = "static", modifiers = "-bundle",
342 cfg(target_feature = "crt-static")))]
343 #[cfg_attr(feature = "rustc-dep-of-std",
344 link(name = "c", cfg(not(target_feature = "crt-static"))))]
345 extern {}
346 } else if #[cfg(target_os = "emscripten")] {
347 #[link(name = "c")]
348 extern {}
349 } else if #[cfg(all(target_os = "netbsd",
350 feature = "rustc-dep-of-std",
351 target_vendor = "rumprun"))] {
352 // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
353 // in automatically by the linker. We avoid passing it explicitly, as it
354 // causes some versions of binutils to crash with an assertion failure.
355 #[link(name = "m")]
356 extern {}
357 } else if #[cfg(any(target_os = "macos",
358 target_os = "ios",
359 target_os = "watchos",
360 target_os = "android",
361 target_os = "openbsd"))] {
362 #[link(name = "c")]
363 #[link(name = "m")]
364 extern {}
365 } else if #[cfg(target_os = "haiku")] {
366 #[link(name = "root")]
367 #[link(name = "network")]
368 extern {}
369 } else if #[cfg(target_env = "newlib")] {
370 #[link(name = "c")]
371 #[link(name = "m")]
372 extern {}
373 } else if #[cfg(target_os = "hermit")] {
374 // no_default_libraries is set to false for HermitCore, so only a link
375 // to "pthread" needs to be added.
376 #[link(name = "pthread")]
377 extern {}
378 } else if #[cfg(target_env = "illumos")] {
379 #[link(name = "c")]
380 #[link(name = "m")]
381 extern {}
382 } else if #[cfg(target_os = "redox")] {
383 #[cfg_attr(feature = "rustc-dep-of-std",
384 link(name = "c", kind = "static", modifiers = "-bundle",
385 cfg(target_feature = "crt-static")))]
386 #[cfg_attr(feature = "rustc-dep-of-std",
387 link(name = "c", cfg(not(target_feature = "crt-static"))))]
388 extern {}
389 } else {
390 #[link(name = "c")]
391 #[link(name = "m")]
392 #[link(name = "rt")]
393 #[link(name = "pthread")]
394 extern {}
395 }
396 }
397
398 #[cfg_attr(feature = "extra_traits", derive(Debug))]
399 pub enum FILE {}
400 impl ::Copy for FILE {}
401 impl ::Clone for FILE {
402 fn clone(&self) -> FILE {
403 *self
404 }
405 }
406 #[cfg_attr(feature = "extra_traits", derive(Debug))]
407 pub enum fpos_t {} // FIXME: fill this out with a struct
408 impl ::Copy for fpos_t {}
409 impl ::Clone for fpos_t {
410 fn clone(&self) -> fpos_t {
411 *self
412 }
413 }
414
415 extern "C" {
416 pub fn isalnum(c: c_int) -> c_int;
417 pub fn isalpha(c: c_int) -> c_int;
418 pub fn iscntrl(c: c_int) -> c_int;
419 pub fn isdigit(c: c_int) -> c_int;
420 pub fn isgraph(c: c_int) -> c_int;
421 pub fn islower(c: c_int) -> c_int;
422 pub fn isprint(c: c_int) -> c_int;
423 pub fn ispunct(c: c_int) -> c_int;
424 pub fn isspace(c: c_int) -> c_int;
425 pub fn isupper(c: c_int) -> c_int;
426 pub fn isxdigit(c: c_int) -> c_int;
427 pub fn isblank(c: c_int) -> c_int;
428 pub fn tolower(c: c_int) -> c_int;
429 pub fn toupper(c: c_int) -> c_int;
430 pub fn qsort(
431 base: *mut c_void,
432 num: size_t,
433 size: size_t,
434 compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
435 );
436 pub fn bsearch(
437 key: *const c_void,
438 base: *const c_void,
439 num: size_t,
440 size: size_t,
441 compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
442 ) -> *mut c_void;
443 #[cfg_attr(
444 all(target_os = "macos", target_arch = "x86"),
445 link_name = "fopen$UNIX2003"
446 )]
447 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
448 #[cfg_attr(
449 all(target_os = "macos", target_arch = "x86"),
450 link_name = "freopen$UNIX2003"
451 )]
452 pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
453 pub fn fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE;
454 pub fn open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE;
455
456 pub fn fflush(file: *mut FILE) -> c_int;
457 pub fn fclose(file: *mut FILE) -> c_int;
458 pub fn remove(filename: *const c_char) -> c_int;
459 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
460 pub fn tmpfile() -> *mut FILE;
461 pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
462 pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
463 pub fn getchar() -> c_int;
464 pub fn putchar(c: c_int) -> c_int;
465 pub fn fgetc(stream: *mut FILE) -> c_int;
466 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
467 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
468 #[cfg_attr(
469 all(target_os = "macos", target_arch = "x86"),
470 link_name = "fputs$UNIX2003"
471 )]
472 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
473 pub fn puts(s: *const c_char) -> c_int;
474 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
475 pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
476 #[cfg_attr(
477 all(target_os = "macos", target_arch = "x86"),
478 link_name = "fwrite$UNIX2003"
479 )]
480 pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
481 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
482 pub fn ftell(stream: *mut FILE) -> c_long;
483 pub fn rewind(stream: *mut FILE);
484 #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
485 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
486 #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
487 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
488 pub fn feof(stream: *mut FILE) -> c_int;
489 pub fn ferror(stream: *mut FILE) -> c_int;
490 pub fn clearerr(stream: *mut FILE);
491 pub fn perror(s: *const c_char);
492 pub fn atoi(s: *const c_char) -> c_int;
493 #[cfg_attr(
494 all(target_os = "macos", target_arch = "x86"),
495 link_name = "strtod$UNIX2003"
496 )]
497 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
498 pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float;
499 pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
500 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
501 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
502 pub fn malloc(size: size_t) -> *mut c_void;
503 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
504 pub fn free(p: *mut c_void);
505 pub fn abort() -> !;
506 pub fn exit(status: c_int) -> !;
507 pub fn _exit(status: c_int) -> !;
508 pub fn atexit(cb: extern "C" fn()) -> c_int;
509 #[cfg_attr(
510 all(target_os = "macos", target_arch = "x86"),
511 link_name = "system$UNIX2003"
512 )]
513 pub fn system(s: *const c_char) -> c_int;
514 pub fn getenv(s: *const c_char) -> *mut c_char;
515
516 pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
517 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
518 pub fn stpcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
519 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
520 pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
521 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
522 pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
523 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
524 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
525 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
526 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
527 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
528 pub fn strdup(cs: *const c_char) -> *mut c_char;
529 pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char;
530 pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
531 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
532 pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
533 pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
534 pub fn strlen(cs: *const c_char) -> size_t;
535 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
536 #[cfg_attr(
537 all(target_os = "macos", target_arch = "x86"),
538 link_name = "strerror$UNIX2003"
539 )]
540 pub fn strerror(n: c_int) -> *mut c_char;
541 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
542 pub fn strtok_r(s: *mut c_char, t: *const c_char, p: *mut *mut c_char) -> *mut c_char;
543 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
544 pub fn strsignal(sig: c_int) -> *mut c_char;
545 pub fn wcslen(buf: *const wchar_t) -> size_t;
546 pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t;
547
548 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
549 pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t;
550 pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
551 pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
552 pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
553 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
554 }
555
556 extern "C" {
557 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
558 pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
559 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
560 pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
561
562 pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
563 pub fn printf(format: *const ::c_char, ...) -> ::c_int;
564 pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int;
565 pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
566 #[cfg_attr(
567 all(target_os = "linux", not(target_env = "uclibc")),
568 link_name = "__isoc99_fscanf"
569 )]
570 pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
571 #[cfg_attr(
572 all(target_os = "linux", not(target_env = "uclibc")),
573 link_name = "__isoc99_scanf"
574 )]
575 pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
576 #[cfg_attr(
577 all(target_os = "linux", not(target_env = "uclibc")),
578 link_name = "__isoc99_sscanf"
579 )]
580 pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
581 pub fn getchar_unlocked() -> ::c_int;
582 pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
583
584 #[cfg(not(all(
585 libc_cfg_target_vendor,
586 target_arch = "powerpc",
587 target_vendor = "nintendo"
588 )))]
589 #[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
590 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
591 #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")]
592 pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
593 #[cfg(not(all(
594 libc_cfg_target_vendor,
595 target_arch = "powerpc",
596 target_vendor = "nintendo"
597 )))]
598 #[cfg_attr(
599 all(target_os = "macos", target_arch = "x86"),
600 link_name = "connect$UNIX2003"
601 )]
602 #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")]
603 #[cfg_attr(target_os = "espidf", link_name = "lwip_connect")]
604 pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int;
605 #[cfg_attr(
606 all(target_os = "macos", target_arch = "x86"),
607 link_name = "listen$UNIX2003"
608 )]
609 #[cfg_attr(target_os = "espidf", link_name = "lwip_listen")]
610 pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
611 #[cfg(not(all(
612 libc_cfg_target_vendor,
613 target_arch = "powerpc",
614 target_vendor = "nintendo"
615 )))]
616 #[cfg_attr(
617 all(target_os = "macos", target_arch = "x86"),
618 link_name = "accept$UNIX2003"
619 )]
620 #[cfg_attr(target_os = "espidf", link_name = "lwip_accept")]
621 pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int;
622 #[cfg(not(all(
623 libc_cfg_target_vendor,
624 target_arch = "powerpc",
625 target_vendor = "nintendo"
626 )))]
627 #[cfg_attr(
628 all(target_os = "macos", target_arch = "x86"),
629 link_name = "getpeername$UNIX2003"
630 )]
631 #[cfg_attr(target_os = "espidf", link_name = "lwip_getpeername")]
632 pub fn getpeername(
633 socket: ::c_int,
634 address: *mut sockaddr,
635 address_len: *mut socklen_t,
636 ) -> ::c_int;
637 #[cfg(not(all(
638 libc_cfg_target_vendor,
639 target_arch = "powerpc",
640 target_vendor = "nintendo"
641 )))]
642 #[cfg_attr(
643 all(target_os = "macos", target_arch = "x86"),
644 link_name = "getsockname$UNIX2003"
645 )]
646 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockname")]
647 pub fn getsockname(
648 socket: ::c_int,
649 address: *mut sockaddr,
650 address_len: *mut socklen_t,
651 ) -> ::c_int;
652 #[cfg_attr(target_os = "espidf", link_name = "lwip_setsockopt")]
653 pub fn setsockopt(
654 socket: ::c_int,
655 level: ::c_int,
656 name: ::c_int,
657 value: *const ::c_void,
658 option_len: socklen_t,
659 ) -> ::c_int;
660 #[cfg_attr(
661 all(target_os = "macos", target_arch = "x86"),
662 link_name = "socketpair$UNIX2003"
663 )]
664 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")]
665 pub fn socketpair(
666 domain: ::c_int,
667 type_: ::c_int,
668 protocol: ::c_int,
669 socket_vector: *mut ::c_int,
670 ) -> ::c_int;
671 #[cfg(not(all(
672 libc_cfg_target_vendor,
673 target_arch = "powerpc",
674 target_vendor = "nintendo"
675 )))]
676 #[cfg_attr(
677 all(target_os = "macos", target_arch = "x86"),
678 link_name = "sendto$UNIX2003"
679 )]
680 #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")]
681 #[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")]
682 pub fn sendto(
683 socket: ::c_int,
684 buf: *const ::c_void,
685 len: ::size_t,
686 flags: ::c_int,
687 addr: *const sockaddr,
688 addrlen: socklen_t,
689 ) -> ::ssize_t;
690 #[cfg_attr(target_os = "espidf", link_name = "lwip_shutdown")]
691 pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
692
693 #[cfg_attr(
694 all(target_os = "macos", target_arch = "x86"),
695 link_name = "chmod$UNIX2003"
696 )]
697 pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int;
698 #[cfg_attr(
699 all(target_os = "macos", target_arch = "x86"),
700 link_name = "fchmod$UNIX2003"
701 )]
702 pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
703
704 #[cfg_attr(
705 all(target_os = "macos", not(target_arch = "aarch64")),
706 link_name = "fstat$INODE64"
707 )]
708 #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
709 #[cfg_attr(
710 all(target_os = "freebsd", any(freebsd11, freebsd10)),
711 link_name = "fstat@FBSD_1.0"
712 )]
713 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
714
715 pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
716
717 #[cfg_attr(
718 all(target_os = "macos", not(target_arch = "aarch64")),
719 link_name = "stat$INODE64"
720 )]
721 #[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
722 #[cfg_attr(
723 all(target_os = "freebsd", any(freebsd11, freebsd10)),
724 link_name = "stat@FBSD_1.0"
725 )]
726 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
727
728 pub fn pclose(stream: *mut ::FILE) -> ::c_int;
729 #[cfg_attr(
730 all(target_os = "macos", target_arch = "x86"),
731 link_name = "fdopen$UNIX2003"
732 )]
733 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
734 pub fn fileno(stream: *mut ::FILE) -> ::c_int;
735
736 #[cfg_attr(
737 all(target_os = "macos", target_arch = "x86"),
738 link_name = "open$UNIX2003"
739 )]
740 pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
741 #[cfg_attr(
742 all(target_os = "macos", target_arch = "x86"),
743 link_name = "creat$UNIX2003"
744 )]
745 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
746 #[cfg_attr(
747 all(target_os = "macos", target_arch = "x86"),
748 link_name = "fcntl$UNIX2003"
749 )]
750 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
751
752 #[cfg_attr(
753 all(target_os = "macos", target_arch = "x86_64"),
754 link_name = "opendir$INODE64"
755 )]
756 #[cfg_attr(
757 all(target_os = "macos", target_arch = "x86"),
758 link_name = "opendir$INODE64$UNIX2003"
759 )]
760 #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
761 pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
762
763 #[cfg_attr(
764 all(target_os = "macos", not(target_arch = "aarch64")),
765 link_name = "readdir$INODE64"
766 )]
767 #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
768 #[cfg_attr(
769 all(target_os = "freebsd", any(freebsd11, freebsd10)),
770 link_name = "readdir@FBSD_1.0"
771 )]
772 pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
773 #[cfg_attr(
774 all(target_os = "macos", target_arch = "x86"),
775 link_name = "closedir$UNIX2003"
776 )]
777 pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
778 #[cfg_attr(
779 all(target_os = "macos", target_arch = "x86_64"),
780 link_name = "rewinddir$INODE64"
781 )]
782 #[cfg_attr(
783 all(target_os = "macos", target_arch = "x86"),
784 link_name = "rewinddir$INODE64$UNIX2003"
785 )]
786 pub fn rewinddir(dirp: *mut ::DIR);
787
788 pub fn fchmodat(
789 dirfd: ::c_int,
790 pathname: *const ::c_char,
791 mode: ::mode_t,
792 flags: ::c_int,
793 ) -> ::c_int;
794 pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int;
795 pub fn fchownat(
796 dirfd: ::c_int,
797 pathname: *const ::c_char,
798 owner: ::uid_t,
799 group: ::gid_t,
800 flags: ::c_int,
801 ) -> ::c_int;
802 #[cfg_attr(
803 all(target_os = "macos", not(target_arch = "aarch64")),
804 link_name = "fstatat$INODE64"
805 )]
806 #[cfg_attr(
807 all(target_os = "freebsd", any(freebsd11, freebsd10)),
808 link_name = "fstatat@FBSD_1.1"
809 )]
810 pub fn fstatat(
811 dirfd: ::c_int,
812 pathname: *const ::c_char,
813 buf: *mut stat,
814 flags: ::c_int,
815 ) -> ::c_int;
816 pub fn linkat(
817 olddirfd: ::c_int,
818 oldpath: *const ::c_char,
819 newdirfd: ::c_int,
820 newpath: *const ::c_char,
821 flags: ::c_int,
822 ) -> ::c_int;
823 pub fn renameat(
824 olddirfd: ::c_int,
825 oldpath: *const ::c_char,
826 newdirfd: ::c_int,
827 newpath: *const ::c_char,
828 ) -> ::c_int;
829 pub fn symlinkat(
830 target: *const ::c_char,
831 newdirfd: ::c_int,
832 linkpath: *const ::c_char,
833 ) -> ::c_int;
834 pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int;
835
836 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
837 pub fn alarm(seconds: ::c_uint) -> ::c_uint;
838 pub fn chdir(dir: *const c_char) -> ::c_int;
839 pub fn fchdir(dirfd: ::c_int) -> ::c_int;
840 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
841 #[cfg_attr(
842 all(target_os = "macos", target_arch = "x86"),
843 link_name = "lchown$UNIX2003"
844 )]
845 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
846 #[cfg_attr(
847 all(target_os = "macos", target_arch = "x86"),
848 link_name = "close$NOCANCEL$UNIX2003"
849 )]
850 #[cfg_attr(
851 all(target_os = "macos", target_arch = "x86_64"),
852 link_name = "close$NOCANCEL"
853 )]
854 pub fn close(fd: ::c_int) -> ::c_int;
855 pub fn dup(fd: ::c_int) -> ::c_int;
856 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
857 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
858 pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
859 pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
860 pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
861 pub fn execve(
862 prog: *const c_char,
863 argv: *const *const c_char,
864 envp: *const *const c_char,
865 ) -> ::c_int;
866 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
867 pub fn fork() -> pid_t;
868 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
869 pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
870 pub fn getegid() -> gid_t;
871 pub fn geteuid() -> uid_t;
872 pub fn getgid() -> gid_t;
873 pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
874 #[cfg_attr(target_os = "illumos", link_name = "getloginx")]
875 pub fn getlogin() -> *mut c_char;
876 #[cfg_attr(
877 all(target_os = "macos", target_arch = "x86"),
878 link_name = "getopt$UNIX2003"
879 )]
880 pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int;
881 pub fn getpgid(pid: pid_t) -> pid_t;
882 pub fn getpgrp() -> pid_t;
883 pub fn getpid() -> pid_t;
884 pub fn getppid() -> pid_t;
885 pub fn getuid() -> uid_t;
886 pub fn isatty(fd: ::c_int) -> ::c_int;
887 pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
888 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
889 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
890 pub fn pipe(fds: *mut ::c_int) -> ::c_int;
891 pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int;
892 #[cfg_attr(
893 all(target_os = "macos", target_arch = "x86"),
894 link_name = "read$UNIX2003"
895 )]
896 pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t;
897 pub fn rmdir(path: *const c_char) -> ::c_int;
898 pub fn seteuid(uid: uid_t) -> ::c_int;
899 pub fn setegid(gid: gid_t) -> ::c_int;
900 pub fn setgid(gid: gid_t) -> ::c_int;
901 pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
902 pub fn setsid() -> pid_t;
903 pub fn setuid(uid: uid_t) -> ::c_int;
904 #[cfg_attr(
905 all(target_os = "macos", target_arch = "x86"),
906 link_name = "sleep$UNIX2003"
907 )]
908 pub fn sleep(secs: ::c_uint) -> ::c_uint;
909 #[cfg_attr(
910 all(target_os = "macos", target_arch = "x86"),
911 link_name = "nanosleep$UNIX2003"
912 )]
913 #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
914 pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int;
915 pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
916 pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int;
917 pub fn ttyname(fd: ::c_int) -> *mut c_char;
918 #[cfg_attr(
919 all(target_os = "macos", target_arch = "x86"),
920 link_name = "ttyname_r$UNIX2003"
921 )]
922 #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
923 pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
924 pub fn unlink(c: *const c_char) -> ::c_int;
925 #[cfg_attr(
926 all(target_os = "macos", target_arch = "x86"),
927 link_name = "wait$UNIX2003"
928 )]
929 pub fn wait(status: *mut ::c_int) -> pid_t;
930 #[cfg_attr(
931 all(target_os = "macos", target_arch = "x86"),
932 link_name = "waitpid$UNIX2003"
933 )]
934 pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t;
935 #[cfg_attr(
936 all(target_os = "macos", target_arch = "x86"),
937 link_name = "write$UNIX2003"
938 )]
939 pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t;
940 #[cfg_attr(
941 all(target_os = "macos", target_arch = "x86"),
942 link_name = "pread$UNIX2003"
943 )]
944 pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
945 #[cfg_attr(
946 all(target_os = "macos", target_arch = "x86"),
947 link_name = "pwrite$UNIX2003"
948 )]
949 pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
950 pub fn umask(mask: mode_t) -> mode_t;
951
952 #[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
953 pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
954
955 #[cfg_attr(
956 all(target_os = "macos", target_arch = "x86"),
957 link_name = "kill$UNIX2003"
958 )]
959 pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
960 #[cfg_attr(
961 all(target_os = "macos", target_arch = "x86"),
962 link_name = "killpg$UNIX2003"
963 )]
964 pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int;
965
966 pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
967 pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
968 pub fn mlockall(flags: ::c_int) -> ::c_int;
969 pub fn munlockall() -> ::c_int;
970
971 #[cfg_attr(
972 all(target_os = "macos", target_arch = "x86"),
973 link_name = "mmap$UNIX2003"
974 )]
975 pub fn mmap(
976 addr: *mut ::c_void,
977 len: ::size_t,
978 prot: ::c_int,
979 flags: ::c_int,
980 fd: ::c_int,
981 offset: off_t,
982 ) -> *mut ::c_void;
983 #[cfg_attr(
984 all(target_os = "macos", target_arch = "x86"),
985 link_name = "munmap$UNIX2003"
986 )]
987 pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
988
989 pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
990 pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char;
991
992 #[cfg_attr(
993 all(target_os = "macos", not(target_arch = "aarch64")),
994 link_name = "lstat$INODE64"
995 )]
996 #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
997 #[cfg_attr(
998 all(target_os = "freebsd", any(freebsd11, freebsd10)),
999 link_name = "lstat@FBSD_1.0"
1000 )]
1001 pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
1002
1003 #[cfg_attr(
1004 all(target_os = "macos", target_arch = "x86"),
1005 link_name = "fsync$UNIX2003"
1006 )]
1007 pub fn fsync(fd: ::c_int) -> ::c_int;
1008
1009 #[cfg_attr(
1010 all(target_os = "macos", target_arch = "x86"),
1011 link_name = "setenv$UNIX2003"
1012 )]
1013 pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int;
1014 #[cfg_attr(
1015 all(target_os = "macos", target_arch = "x86"),
1016 link_name = "unsetenv$UNIX2003"
1017 )]
1018 #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
1019 pub fn unsetenv(name: *const c_char) -> ::c_int;
1020
1021 pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int;
1022
1023 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
1024
1025 pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
1026
1027 #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
1028 pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
1029
1030 #[cfg_attr(
1031 any(target_os = "macos", target_os = "ios", target_os = "watchos"),
1032 link_name = "realpath$DARWIN_EXTSN"
1033 )]
1034 pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;
1035
1036 pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
1037
1038 #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
1039 pub fn times(buf: *mut ::tms) -> ::clock_t;
1040
1041 pub fn pthread_self() -> ::pthread_t;
1042 #[cfg_attr(
1043 all(target_os = "macos", target_arch = "x86"),
1044 link_name = "pthread_join$UNIX2003"
1045 )]
1046 pub fn pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int;
1047 pub fn pthread_exit(value: *mut ::c_void) -> !;
1048 pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
1049 pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
1050 pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stack_size: ::size_t) -> ::c_int;
1051 pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int;
1052 pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
1053 #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
1054 pub fn sched_yield() -> ::c_int;
1055 pub fn pthread_key_create(
1056 key: *mut pthread_key_t,
1057 dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>,
1058 ) -> ::c_int;
1059 pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int;
1060 pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
1061 pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int;
1062 pub fn pthread_mutex_init(
1063 lock: *mut pthread_mutex_t,
1064 attr: *const pthread_mutexattr_t,
1065 ) -> ::c_int;
1066 pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int;
1067 pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int;
1068 pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int;
1069 pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
1070
1071 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
1072 #[cfg_attr(
1073 all(target_os = "macos", target_arch = "x86"),
1074 link_name = "pthread_mutexattr_destroy$UNIX2003"
1075 )]
1076 pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
1077 pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int;
1078
1079 #[cfg_attr(
1080 all(target_os = "macos", target_arch = "x86"),
1081 link_name = "pthread_cond_init$UNIX2003"
1082 )]
1083 pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t)
1084 -> ::c_int;
1085 #[cfg_attr(
1086 all(target_os = "macos", target_arch = "x86"),
1087 link_name = "pthread_cond_wait$UNIX2003"
1088 )]
1089 pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int;
1090 #[cfg_attr(
1091 all(target_os = "macos", target_arch = "x86"),
1092 link_name = "pthread_cond_timedwait$UNIX2003"
1093 )]
1094 pub fn pthread_cond_timedwait(
1095 cond: *mut pthread_cond_t,
1096 lock: *mut pthread_mutex_t,
1097 abstime: *const ::timespec,
1098 ) -> ::c_int;
1099 pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
1100 pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
1101 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
1102 pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
1103 pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
1104 #[cfg_attr(
1105 all(target_os = "macos", target_arch = "x86"),
1106 link_name = "pthread_rwlock_init$UNIX2003"
1107 )]
1108 pub fn pthread_rwlock_init(
1109 lock: *mut pthread_rwlock_t,
1110 attr: *const pthread_rwlockattr_t,
1111 ) -> ::c_int;
1112 #[cfg_attr(
1113 all(target_os = "macos", target_arch = "x86"),
1114 link_name = "pthread_rwlock_destroy$UNIX2003"
1115 )]
1116 pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
1117 #[cfg_attr(
1118 all(target_os = "macos", target_arch = "x86"),
1119 link_name = "pthread_rwlock_rdlock$UNIX2003"
1120 )]
1121 pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1122 #[cfg_attr(
1123 all(target_os = "macos", target_arch = "x86"),
1124 link_name = "pthread_rwlock_tryrdlock$UNIX2003"
1125 )]
1126 pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1127 #[cfg_attr(
1128 all(target_os = "macos", target_arch = "x86"),
1129 link_name = "pthread_rwlock_wrlock$UNIX2003"
1130 )]
1131 pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1132 #[cfg_attr(
1133 all(target_os = "macos", target_arch = "x86"),
1134 link_name = "pthread_rwlock_trywrlock$UNIX2003"
1135 )]
1136 pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1137 #[cfg_attr(
1138 all(target_os = "macos", target_arch = "x86"),
1139 link_name = "pthread_rwlock_unlock$UNIX2003"
1140 )]
1141 pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
1142 pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
1143 pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int;
1144
1145 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")]
1146 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")]
1147 pub fn getsockopt(
1148 sockfd: ::c_int,
1149 level: ::c_int,
1150 optname: ::c_int,
1151 optval: *mut ::c_void,
1152 optlen: *mut ::socklen_t,
1153 ) -> ::c_int;
1154 pub fn raise(signum: ::c_int) -> ::c_int;
1155 #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
1156 pub fn sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int;
1157
1158 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
1159 pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int;
1160 pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
1161 pub fn dlerror() -> *mut ::c_char;
1162 pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void;
1163 pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
1164 pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
1165
1166 #[cfg(not(all(
1167 libc_cfg_target_vendor,
1168 target_arch = "powerpc",
1169 target_vendor = "nintendo"
1170 )))]
1171 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")]
1172 #[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")]
1173 pub fn getaddrinfo(
1174 node: *const c_char,
1175 service: *const c_char,
1176 hints: *const addrinfo,
1177 res: *mut *mut addrinfo,
1178 ) -> ::c_int;
1179 #[cfg(not(all(
1180 libc_cfg_target_vendor,
1181 target_arch = "powerpc",
1182 target_vendor = "nintendo"
1183 )))]
1184 #[cfg_attr(target_os = "espidf", link_name = "lwip_freeaddrinfo")]
1185 pub fn freeaddrinfo(res: *mut addrinfo);
1186 pub fn hstrerror(errcode: ::c_int) -> *const ::c_char;
1187 pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
1188 #[cfg_attr(
1189 any(
1190 all(target_os = "linux", not(target_env = "musl")),
1191 target_os = "freebsd",
1192 target_os = "dragonfly",
1193 target_os = "haiku"
1194 ),
1195 link_name = "__res_init"
1196 )]
1197 #[cfg_attr(
1198 any(target_os = "macos", target_os = "ios", target_os = "watchos"),
1199 link_name = "res_9_init"
1200 )]
1201 pub fn res_init() -> ::c_int;
1202
1203 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
1204 #[cfg_attr(target_env = "musl", allow(deprecated))]
1205 // FIXME: for `time_t`
1206 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1207 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
1208 #[cfg_attr(target_env = "musl", allow(deprecated))]
1209 // FIXME: for `time_t`
1210 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
1211 #[cfg_attr(
1212 all(target_os = "macos", target_arch = "x86"),
1213 link_name = "mktime$UNIX2003"
1214 )]
1215 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
1216 #[cfg_attr(target_env = "musl", allow(deprecated))]
1217 // FIXME: for `time_t`
1218 pub fn mktime(tm: *mut tm) -> time_t;
1219 #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
1220 #[cfg_attr(target_env = "musl", allow(deprecated))]
1221 // FIXME: for `time_t`
1222 pub fn time(time: *mut time_t) -> time_t;
1223 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
1224 #[cfg_attr(target_env = "musl", allow(deprecated))]
1225 // FIXME: for `time_t`
1226 pub fn gmtime(time_p: *const time_t) -> *mut tm;
1227 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
1228 #[cfg_attr(target_env = "musl", allow(deprecated))]
1229 // FIXME: for `time_t`
1230 pub fn localtime(time_p: *const time_t) -> *mut tm;
1231 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
1232 #[cfg_attr(target_env = "musl", allow(deprecated))]
1233 // FIXME: for `time_t`
1234 pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
1235 #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
1236 #[cfg_attr(target_env = "musl", allow(deprecated))]
1237 // FIXME: for `time_t`
1238 pub fn timegm(tm: *mut ::tm) -> time_t;
1239
1240 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
1241 #[cfg_attr(
1242 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1243 link_name = "mknod@FBSD_1.0"
1244 )]
1245 pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int;
1246 pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
1247 pub fn endservent();
1248 pub fn getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent;
1249 pub fn getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent;
1250 pub fn getservent() -> *mut servent;
1251 pub fn setservent(stayopen: ::c_int);
1252 pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
1253 pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
1254 pub fn chroot(name: *const ::c_char) -> ::c_int;
1255 #[cfg_attr(
1256 all(target_os = "macos", target_arch = "x86"),
1257 link_name = "usleep$UNIX2003"
1258 )]
1259 pub fn usleep(secs: ::c_uint) -> ::c_int;
1260 #[cfg_attr(
1261 all(target_os = "macos", target_arch = "x86"),
1262 link_name = "send$UNIX2003"
1263 )]
1264 #[cfg_attr(target_os = "espidf", link_name = "lwip_send")]
1265 pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
1266 #[cfg_attr(
1267 all(target_os = "macos", target_arch = "x86"),
1268 link_name = "recv$UNIX2003"
1269 )]
1270 #[cfg_attr(target_os = "espidf", link_name = "lwip_recv")]
1271 pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
1272 #[cfg_attr(
1273 all(target_os = "macos", target_arch = "x86"),
1274 link_name = "putenv$UNIX2003"
1275 )]
1276 #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
1277 pub fn putenv(string: *mut c_char) -> ::c_int;
1278 #[cfg_attr(
1279 all(target_os = "macos", target_arch = "x86"),
1280 link_name = "poll$UNIX2003"
1281 )]
1282 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
1283 #[cfg_attr(
1284 all(target_os = "macos", target_arch = "x86_64"),
1285 link_name = "select$1050"
1286 )]
1287 #[cfg_attr(
1288 all(target_os = "macos", target_arch = "x86"),
1289 link_name = "select$UNIX2003"
1290 )]
1291 #[cfg_attr(target_os = "netbsd", link_name = "__select50")]
1292 pub fn select(
1293 nfds: ::c_int,
1294 readfs: *mut fd_set,
1295 writefds: *mut fd_set,
1296 errorfds: *mut fd_set,
1297 timeout: *mut timeval,
1298 ) -> ::c_int;
1299 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
1300 pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char;
1301 pub fn localeconv() -> *mut lconv;
1302
1303 #[cfg_attr(
1304 all(target_os = "macos", target_arch = "x86"),
1305 link_name = "sem_wait$UNIX2003"
1306 )]
1307 pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
1308 pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
1309 pub fn sem_post(sem: *mut sem_t) -> ::c_int;
1310 pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
1311 pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
1312
1313 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t;
1314
1315 #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
1316 pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
1317 #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
1318 pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1319 #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")]
1320 pub fn sigfillset(set: *mut sigset_t) -> ::c_int;
1321 #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")]
1322 pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
1323 #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")]
1324 pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
1325
1326 #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
1327 pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
1328 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
1329 pub fn sigpending(set: *mut sigset_t) -> ::c_int;
1330
1331 pub fn sysconf(name: ::c_int) -> ::c_long;
1332
1333 pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
1334
1335 #[cfg_attr(
1336 all(target_os = "macos", target_arch = "x86_64"),
1337 link_name = "pselect$1050"
1338 )]
1339 #[cfg_attr(
1340 all(target_os = "macos", target_arch = "x86"),
1341 link_name = "pselect$UNIX2003"
1342 )]
1343 #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
1344 pub fn pselect(
1345 nfds: ::c_int,
1346 readfs: *mut fd_set,
1347 writefds: *mut fd_set,
1348 errorfds: *mut fd_set,
1349 timeout: *const timespec,
1350 sigmask: *const sigset_t,
1351 ) -> ::c_int;
1352 pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int;
1353 pub fn ftello(stream: *mut ::FILE) -> ::off_t;
1354 #[cfg_attr(
1355 all(target_os = "macos", target_arch = "x86"),
1356 link_name = "tcdrain$UNIX2003"
1357 )]
1358 pub fn tcdrain(fd: ::c_int) -> ::c_int;
1359 pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
1360 pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t;
1361 pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
1362 pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
1363 pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
1364 pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int;
1365 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
1366 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
1367 pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
1368 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
1369 pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
1370 pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
1371
1372 pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char;
1373
1374 pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
1375 pub fn closelog();
1376 pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
1377 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
1378 pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
1379 #[cfg_attr(
1380 all(target_os = "macos", target_arch = "x86"),
1381 link_name = "nice$UNIX2003"
1382 )]
1383 pub fn nice(incr: ::c_int) -> ::c_int;
1384
1385 pub fn grantpt(fd: ::c_int) -> ::c_int;
1386 pub fn posix_openpt(flags: ::c_int) -> ::c_int;
1387 pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
1388 pub fn unlockpt(fd: ::c_int) -> ::c_int;
1389
1390 pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
1391 pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
1392
1393 pub fn lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int;
1394
1395 }
1396 cfg_if! {
1397 if #[cfg(not(any(target_os = "emscripten",
1398 target_os = "android",
1399 target_os = "haiku")))] {
1400 extern "C" {
1401 pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int;
1402 pub fn stpncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
1403 }
1404 }
1405 }
1406
1407 cfg_if! {
1408 if #[cfg(not(target_env = "uclibc"))] {
1409 extern "C" {
1410 pub fn open_wmemstream(
1411 ptr: *mut *mut wchar_t,
1412 sizeloc: *mut size_t,
1413 ) -> *mut FILE;
1414 }
1415 }
1416 }
1417
1418 cfg_if! {
1419 if #[cfg(not(target_os = "redox"))] {
1420 extern {
1421 pub fn getsid(pid: pid_t) -> pid_t;
1422 pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
1423 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1424 link_name = "pause$UNIX2003")]
1425 pub fn pause() -> ::c_int;
1426
1427 pub fn readlinkat(dirfd: ::c_int,
1428 pathname: *const ::c_char,
1429 buf: *mut ::c_char,
1430 bufsiz: ::size_t) -> ::ssize_t;
1431 pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
1432 mode: ::mode_t) -> ::c_int;
1433 pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
1434 flags: ::c_int, ...) -> ::c_int;
1435
1436 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1437 link_name = "fdopendir$INODE64")]
1438 #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1439 link_name = "fdopendir$INODE64$UNIX2003")]
1440 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
1441
1442 #[cfg_attr(all(target_os = "macos", not(target_arch = "aarch64")),
1443 link_name = "readdir_r$INODE64")]
1444 #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
1445 #[cfg_attr(
1446 all(target_os = "freebsd", any(freebsd11, freebsd10)),
1447 link_name = "readdir_r@FBSD_1.0"
1448 )]
1449 #[allow(non_autolinks)] // FIXME: `<>` breaks line length limit.
1450 /// The 64-bit libc on Solaris and illumos only has readdir_r. If a
1451 /// 32-bit Solaris or illumos target is ever created, it should use
1452 /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos:
1453 /// https://illumos.org/man/3lib/libc
1454 /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html
1455 /// https://www.unix.com/man-page/opensolaris/3LIB/libc/
1456 pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
1457 result: *mut *mut ::dirent) -> ::c_int;
1458 }
1459 }
1460 }
1461
1462 cfg_if! {
1463 if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] {
1464 extern {
1465 pub fn cfmakeraw(termios: *mut ::termios);
1466 pub fn cfsetspeed(termios: *mut ::termios,
1467 speed: ::speed_t) -> ::c_int;
1468 }
1469 }
1470 }
1471
1472 cfg_if! {
1473 if #[cfg(target_env = "newlib")] {
1474 mod newlib;
1475 pub use self::newlib::*;
1476 } else if #[cfg(any(target_os = "linux",
1477 target_os = "l4re",
1478 target_os = "android",
1479 target_os = "emscripten"))] {
1480 mod linux_like;
1481 pub use self::linux_like::*;
1482 } else if #[cfg(any(target_os = "macos",
1483 target_os = "ios",
1484 target_os = "watchos",
1485 target_os = "freebsd",
1486 target_os = "dragonfly",
1487 target_os = "openbsd",
1488 target_os = "netbsd"))] {
1489 mod bsd;
1490 pub use self::bsd::*;
1491 } else if #[cfg(any(target_os = "solaris",
1492 target_os = "illumos"))] {
1493 mod solarish;
1494 pub use self::solarish::*;
1495 } else if #[cfg(target_os = "haiku")] {
1496 mod haiku;
1497 pub use self::haiku::*;
1498 } else if #[cfg(target_os = "hermit")] {
1499 mod hermit;
1500 pub use self::hermit::*;
1501 } else if #[cfg(target_os = "redox")] {
1502 mod redox;
1503 pub use self::redox::*;
1504 } else {
1505 // Unknown target_os
1506 }
1507 }
1508
1509 cfg_if! {
1510 if #[cfg(libc_core_cvoid)] {
1511 pub use ::ffi::c_void;
1512 } else {
1513 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
1514 // enable more optimization opportunities around it recognizing things
1515 // like malloc/free.
1516 #[repr(u8)]
1517 #[allow(missing_copy_implementations)]
1518 #[allow(missing_debug_implementations)]
1519 pub enum c_void {
1520 // Two dummy variants so the #[repr] attribute can be used.
1521 #[doc(hidden)]
1522 __variant1,
1523 #[doc(hidden)]
1524 __variant2,
1525 }
1526 }
1527 }
1528
1529 cfg_if! {
1530 if #[cfg(libc_align)] {
1531 mod align;
1532 pub use self::align::*;
1533 } else {
1534 mod no_align;
1535 pub use self::no_align::*;
1536 }
1537 }