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