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