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