1 //! Definitions found commonly among almost all Unix derivatives 2 //! 3 //! More functions and definitions can be found in the more specific modules 4 //! according to the platform in question. 5 6 pub type c_schar = i8; 7 pub type c_uchar = u8; 8 pub type c_short = i16; 9 pub type c_ushort = u16; 10 pub type c_int = i32; 11 pub type c_uint = u32; 12 pub type c_float = f32; 13 pub type c_double = f64; 14 pub type c_longlong = i64; 15 pub type c_ulonglong = u64; 16 pub type intmax_t = i64; 17 pub type uintmax_t = u64; 18 19 pub type size_t = usize; 20 pub type ptrdiff_t = isize; 21 pub type intptr_t = isize; 22 pub type uintptr_t = usize; 23 pub type ssize_t = isize; 24 25 pub type pid_t = i32; 26 pub type uid_t = u32; 27 pub type gid_t = u32; 28 pub type in_addr_t = u32; 29 pub type in_port_t = u16; 30 pub type sighandler_t = ::size_t; 31 pub type cc_t = ::c_uchar; 32 33 #[cfg_attr(feature = "extra_traits", derive(Debug))] 34 pub enum DIR {} 35 impl ::Copy for DIR {} 36 impl ::Clone for DIR { clone(&self) -> DIR37 fn clone(&self) -> DIR { 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 { clone(&self) -> FILE393 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 { clone(&self) -> fpos_t401 fn clone(&self) -> fpos_t { 402 *self 403 } 404 } 405 406 extern "C" { isalnum(c: c_int) -> c_int407 pub fn isalnum(c: c_int) -> c_int; isalpha(c: c_int) -> c_int408 pub fn isalpha(c: c_int) -> c_int; iscntrl(c: c_int) -> c_int409 pub fn iscntrl(c: c_int) -> c_int; isdigit(c: c_int) -> c_int410 pub fn isdigit(c: c_int) -> c_int; isgraph(c: c_int) -> c_int411 pub fn isgraph(c: c_int) -> c_int; islower(c: c_int) -> c_int412 pub fn islower(c: c_int) -> c_int; isprint(c: c_int) -> c_int413 pub fn isprint(c: c_int) -> c_int; ispunct(c: c_int) -> c_int414 pub fn ispunct(c: c_int) -> c_int; isspace(c: c_int) -> c_int415 pub fn isspace(c: c_int) -> c_int; isupper(c: c_int) -> c_int416 pub fn isupper(c: c_int) -> c_int; isxdigit(c: c_int) -> c_int417 pub fn isxdigit(c: c_int) -> c_int; isblank(c: c_int) -> c_int418 pub fn isblank(c: c_int) -> c_int; tolower(c: c_int) -> c_int419 pub fn tolower(c: c_int) -> c_int; toupper(c: c_int) -> c_int420 pub fn toupper(c: c_int) -> c_int; qsort( base: *mut c_void, num: size_t, size: size_t, compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, )421 pub fn qsort( 422 base: *mut c_void, 423 num: size_t, 424 size: size_t, 425 compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, 426 ); bsearch( key: *const c_void, base: *const c_void, num: size_t, size: size_t, compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, ) -> *mut c_void427 pub fn bsearch( 428 key: *const c_void, 429 base: *const c_void, 430 num: size_t, 431 size: size_t, 432 compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, 433 ) -> *mut c_void; 434 #[cfg_attr( 435 all(target_os = "macos", target_arch = "x86"), 436 link_name = "fopen$UNIX2003" 437 )] fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE438 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; 439 #[cfg_attr( 440 all(target_os = "macos", target_arch = "x86"), 441 link_name = "freopen$UNIX2003" 442 )] freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE443 pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE; fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE444 pub fn fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE; open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE445 pub fn open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE; 446 fflush(file: *mut FILE) -> c_int447 pub fn fflush(file: *mut FILE) -> c_int; fclose(file: *mut FILE) -> c_int448 pub fn fclose(file: *mut FILE) -> c_int; remove(filename: *const c_char) -> c_int449 pub fn remove(filename: *const c_char) -> c_int; rename(oldname: *const c_char, newname: *const c_char) -> c_int450 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; tmpfile() -> *mut FILE451 pub fn tmpfile() -> *mut FILE; setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int452 pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int; setbuf(stream: *mut FILE, buf: *mut c_char)453 pub fn setbuf(stream: *mut FILE, buf: *mut c_char); getchar() -> c_int454 pub fn getchar() -> c_int; putchar(c: c_int) -> c_int455 pub fn putchar(c: c_int) -> c_int; fgetc(stream: *mut FILE) -> c_int456 pub fn fgetc(stream: *mut FILE) -> c_int; fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char457 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; fputc(c: c_int, stream: *mut FILE) -> c_int458 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; 459 #[cfg_attr( 460 all(target_os = "macos", target_arch = "x86"), 461 link_name = "fputs$UNIX2003" 462 )] fputs(s: *const c_char, stream: *mut FILE) -> c_int463 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int; puts(s: *const c_char) -> c_int464 pub fn puts(s: *const c_char) -> c_int; ungetc(c: c_int, stream: *mut FILE) -> c_int465 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t466 pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; 467 #[cfg_attr( 468 all(target_os = "macos", target_arch = "x86"), 469 link_name = "fwrite$UNIX2003" 470 )] fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t471 pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int472 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; ftell(stream: *mut FILE) -> c_long473 pub fn ftell(stream: *mut FILE) -> c_long; rewind(stream: *mut FILE)474 pub fn rewind(stream: *mut FILE); 475 #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int476 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; 477 #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int478 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; feof(stream: *mut FILE) -> c_int479 pub fn feof(stream: *mut FILE) -> c_int; ferror(stream: *mut FILE) -> c_int480 pub fn ferror(stream: *mut FILE) -> c_int; clearerr(stream: *mut FILE)481 pub fn clearerr(stream: *mut FILE); perror(s: *const c_char)482 pub fn perror(s: *const c_char); atoi(s: *const c_char) -> c_int483 pub fn atoi(s: *const c_char) -> c_int; 484 #[cfg_attr( 485 all(target_os = "macos", target_arch = "x86"), 486 link_name = "strtod$UNIX2003" 487 )] strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double488 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long489 pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong490 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; calloc(nobj: size_t, size: size_t) -> *mut c_void491 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; malloc(size: size_t) -> *mut c_void492 pub fn malloc(size: size_t) -> *mut c_void; realloc(p: *mut c_void, size: size_t) -> *mut c_void493 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; free(p: *mut c_void)494 pub fn free(p: *mut c_void); abort() -> !495 pub fn abort() -> !; exit(status: c_int) -> !496 pub fn exit(status: c_int) -> !; _exit(status: c_int) -> !497 pub fn _exit(status: c_int) -> !; atexit(cb: extern "C" fn()) -> c_int498 pub fn atexit(cb: extern "C" fn()) -> c_int; 499 #[cfg_attr( 500 all(target_os = "macos", target_arch = "x86"), 501 link_name = "system$UNIX2003" 502 )] system(s: *const c_char) -> c_int503 pub fn system(s: *const c_char) -> c_int; getenv(s: *const c_char) -> *mut c_char504 pub fn getenv(s: *const c_char) -> *mut c_char; 505 strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char506 pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char507 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char508 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char509 pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; strcmp(cs: *const c_char, ct: *const c_char) -> c_int510 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int511 pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; strcoll(cs: *const c_char, ct: *const c_char) -> c_int512 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; strchr(cs: *const c_char, c: c_int) -> *mut c_char513 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; strrchr(cs: *const c_char, c: c_int) -> *mut c_char514 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; strspn(cs: *const c_char, ct: *const c_char) -> size_t515 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; strcspn(cs: *const c_char, ct: *const c_char) -> size_t516 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; strdup(cs: *const c_char) -> *mut c_char517 pub fn strdup(cs: *const c_char) -> *mut c_char; strndup(cs: *const c_char, n: size_t) -> *mut c_char518 pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char; strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char519 pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char520 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int521 pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int522 pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int; strlen(cs: *const c_char) -> size_t523 pub fn strlen(cs: *const c_char) -> size_t; strnlen(cs: *const c_char, maxlen: size_t) -> size_t524 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; 525 #[cfg_attr( 526 all(target_os = "macos", target_arch = "x86"), 527 link_name = "strerror$UNIX2003" 528 )] strerror(n: c_int) -> *mut c_char529 pub fn strerror(n: c_int) -> *mut c_char; strtok(s: *mut c_char, t: *const c_char) -> *mut c_char530 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t531 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; strsignal(sig: c_int) -> *mut c_char532 pub fn strsignal(sig: c_int) -> *mut c_char; wcslen(buf: *const wchar_t) -> size_t533 pub fn wcslen(buf: *const wchar_t) -> size_t; wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t534 pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t; 535 memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void536 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t537 pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t; memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int538 pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void539 pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void540 pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void541 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; 542 } 543 544 extern "C" { 545 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")] getpwnam(name: *const ::c_char) -> *mut passwd546 pub fn getpwnam(name: *const ::c_char) -> *mut passwd; 547 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")] getpwuid(uid: ::uid_t) -> *mut passwd548 pub fn getpwuid(uid: ::uid_t) -> *mut passwd; 549 fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int550 pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; printf(format: *const ::c_char, ...) -> ::c_int551 pub fn printf(format: *const ::c_char, ...) -> ::c_int; snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int552 pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int; sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int553 pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; 554 #[cfg_attr( 555 all(target_os = "linux", not(target_env = "uclibc")), 556 link_name = "__isoc99_fscanf" 557 )] fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int558 pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; 559 #[cfg_attr( 560 all(target_os = "linux", not(target_env = "uclibc")), 561 link_name = "__isoc99_scanf" 562 )] scanf(format: *const ::c_char, ...) -> ::c_int563 pub fn scanf(format: *const ::c_char, ...) -> ::c_int; 564 #[cfg_attr( 565 all(target_os = "linux", not(target_env = "uclibc")), 566 link_name = "__isoc99_sscanf" 567 )] sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int568 pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int; getchar_unlocked() -> ::c_int569 pub fn getchar_unlocked() -> ::c_int; putchar_unlocked(c: ::c_int) -> ::c_int570 pub fn putchar_unlocked(c: ::c_int) -> ::c_int; 571 572 #[cfg(not(all( 573 libc_cfg_target_vendor, 574 target_arch = "powerpc", 575 target_vendor = "nintendo" 576 )))] 577 #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] 578 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")] socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int579 pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; 580 #[cfg(not(all( 581 libc_cfg_target_vendor, 582 target_arch = "powerpc", 583 target_vendor = "nintendo" 584 )))] 585 #[cfg_attr( 586 all(target_os = "macos", target_arch = "x86"), 587 link_name = "connect$UNIX2003" 588 )] 589 #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")] connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int590 pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int; 591 #[cfg_attr( 592 all(target_os = "macos", target_arch = "x86"), 593 link_name = "listen$UNIX2003" 594 )] listen(socket: ::c_int, backlog: ::c_int) -> ::c_int595 pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; 596 #[cfg(not(all( 597 libc_cfg_target_vendor, 598 target_arch = "powerpc", 599 target_vendor = "nintendo" 600 )))] 601 #[cfg_attr( 602 all(target_os = "macos", target_arch = "x86"), 603 link_name = "accept$UNIX2003" 604 )] accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int605 pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int; 606 #[cfg(not(all( 607 libc_cfg_target_vendor, 608 target_arch = "powerpc", 609 target_vendor = "nintendo" 610 )))] 611 #[cfg_attr( 612 all(target_os = "macos", target_arch = "x86"), 613 link_name = "getpeername$UNIX2003" 614 )] getpeername( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int615 pub fn getpeername( 616 socket: ::c_int, 617 address: *mut sockaddr, 618 address_len: *mut socklen_t, 619 ) -> ::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 = "getsockname$UNIX2003" 628 )] getsockname( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int629 pub fn getsockname( 630 socket: ::c_int, 631 address: *mut sockaddr, 632 address_len: *mut socklen_t, 633 ) -> ::c_int; setsockopt( socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, option_len: socklen_t, ) -> ::c_int634 pub fn setsockopt( 635 socket: ::c_int, 636 level: ::c_int, 637 name: ::c_int, 638 value: *const ::c_void, 639 option_len: socklen_t, 640 ) -> ::c_int; 641 #[cfg_attr( 642 all(target_os = "macos", target_arch = "x86"), 643 link_name = "socketpair$UNIX2003" 644 )] 645 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")] socketpair( domain: ::c_int, type_: ::c_int, protocol: ::c_int, socket_vector: *mut ::c_int, ) -> ::c_int646 pub fn socketpair( 647 domain: ::c_int, 648 type_: ::c_int, 649 protocol: ::c_int, 650 socket_vector: *mut ::c_int, 651 ) -> ::c_int; 652 #[cfg(not(all( 653 libc_cfg_target_vendor, 654 target_arch = "powerpc", 655 target_vendor = "nintendo" 656 )))] 657 #[cfg_attr( 658 all(target_os = "macos", target_arch = "x86"), 659 link_name = "sendto$UNIX2003" 660 )] 661 #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")] sendto( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, addr: *const sockaddr, addrlen: socklen_t, ) -> ::ssize_t662 pub fn sendto( 663 socket: ::c_int, 664 buf: *const ::c_void, 665 len: ::size_t, 666 flags: ::c_int, 667 addr: *const sockaddr, 668 addrlen: socklen_t, 669 ) -> ::ssize_t; shutdown(socket: ::c_int, how: ::c_int) -> ::c_int670 pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; 671 672 #[cfg_attr( 673 all(target_os = "macos", target_arch = "x86"), 674 link_name = "chmod$UNIX2003" 675 )] chmod(path: *const c_char, mode: mode_t) -> ::c_int676 pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; 677 #[cfg_attr( 678 all(target_os = "macos", target_arch = "x86"), 679 link_name = "fchmod$UNIX2003" 680 )] fchmod(fd: ::c_int, mode: mode_t) -> ::c_int681 pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; 682 683 #[cfg_attr( 684 all(target_os = "macos", not(target_arch = "aarch64")), 685 link_name = "fstat$INODE64" 686 )] 687 #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")] 688 #[cfg_attr( 689 all(target_os = "freebsd", any(freebsd11, freebsd10)), 690 link_name = "fstat@FBSD_1.0" 691 )] fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int692 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; 693 mkdir(path: *const c_char, mode: mode_t) -> ::c_int694 pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; 695 696 #[cfg_attr( 697 all(target_os = "macos", not(target_arch = "aarch64")), 698 link_name = "stat$INODE64" 699 )] 700 #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] 701 #[cfg_attr( 702 all(target_os = "freebsd", any(freebsd11, freebsd10)), 703 link_name = "stat@FBSD_1.0" 704 )] stat(path: *const c_char, buf: *mut stat) -> ::c_int705 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; 706 pclose(stream: *mut ::FILE) -> ::c_int707 pub fn pclose(stream: *mut ::FILE) -> ::c_int; 708 #[cfg_attr( 709 all(target_os = "macos", target_arch = "x86"), 710 link_name = "fdopen$UNIX2003" 711 )] fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE712 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; fileno(stream: *mut ::FILE) -> ::c_int713 pub fn fileno(stream: *mut ::FILE) -> ::c_int; 714 715 #[cfg_attr( 716 all(target_os = "macos", target_arch = "x86"), 717 link_name = "open$UNIX2003" 718 )] open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int719 pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; 720 #[cfg_attr( 721 all(target_os = "macos", target_arch = "x86"), 722 link_name = "creat$UNIX2003" 723 )] creat(path: *const c_char, mode: mode_t) -> ::c_int724 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; 725 #[cfg_attr( 726 all(target_os = "macos", target_arch = "x86"), 727 link_name = "fcntl$UNIX2003" 728 )] fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int729 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; 730 731 #[cfg_attr( 732 all(target_os = "macos", target_arch = "x86_64"), 733 link_name = "opendir$INODE64" 734 )] 735 #[cfg_attr( 736 all(target_os = "macos", target_arch = "x86"), 737 link_name = "opendir$INODE64$UNIX2003" 738 )] 739 #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] opendir(dirname: *const c_char) -> *mut ::DIR740 pub fn opendir(dirname: *const c_char) -> *mut ::DIR; 741 742 #[cfg_attr( 743 all(target_os = "macos", not(target_arch = "aarch64")), 744 link_name = "readdir$INODE64" 745 )] 746 #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")] 747 #[cfg_attr( 748 all(target_os = "freebsd", any(freebsd11, freebsd10)), 749 link_name = "readdir@FBSD_1.0" 750 )] readdir(dirp: *mut ::DIR) -> *mut ::dirent751 pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; 752 #[cfg_attr( 753 all(target_os = "macos", target_arch = "x86"), 754 link_name = "closedir$UNIX2003" 755 )] closedir(dirp: *mut ::DIR) -> ::c_int756 pub fn closedir(dirp: *mut ::DIR) -> ::c_int; 757 #[cfg_attr( 758 all(target_os = "macos", target_arch = "x86_64"), 759 link_name = "rewinddir$INODE64" 760 )] 761 #[cfg_attr( 762 all(target_os = "macos", target_arch = "x86"), 763 link_name = "rewinddir$INODE64$UNIX2003" 764 )] rewinddir(dirp: *mut ::DIR)765 pub fn rewinddir(dirp: *mut ::DIR); 766 fchmodat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, flags: ::c_int, ) -> ::c_int767 pub fn fchmodat( 768 dirfd: ::c_int, 769 pathname: *const ::c_char, 770 mode: ::mode_t, 771 flags: ::c_int, 772 ) -> ::c_int; fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int773 pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int; fchownat( dirfd: ::c_int, pathname: *const ::c_char, owner: ::uid_t, group: ::gid_t, flags: ::c_int, ) -> ::c_int774 pub fn fchownat( 775 dirfd: ::c_int, 776 pathname: *const ::c_char, 777 owner: ::uid_t, 778 group: ::gid_t, 779 flags: ::c_int, 780 ) -> ::c_int; 781 #[cfg_attr( 782 all(target_os = "macos", not(target_arch = "aarch64")), 783 link_name = "fstatat$INODE64" 784 )] 785 #[cfg_attr( 786 all(target_os = "freebsd", any(freebsd11, freebsd10)), 787 link_name = "fstatat@FBSD_1.1" 788 )] fstatat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int, ) -> ::c_int789 pub fn fstatat( 790 dirfd: ::c_int, 791 pathname: *const ::c_char, 792 buf: *mut stat, 793 flags: ::c_int, 794 ) -> ::c_int; linkat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int, ) -> ::c_int795 pub fn linkat( 796 olddirfd: ::c_int, 797 oldpath: *const ::c_char, 798 newdirfd: ::c_int, 799 newpath: *const ::c_char, 800 flags: ::c_int, 801 ) -> ::c_int; renameat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, ) -> ::c_int802 pub fn renameat( 803 olddirfd: ::c_int, 804 oldpath: *const ::c_char, 805 newdirfd: ::c_int, 806 newpath: *const ::c_char, 807 ) -> ::c_int; symlinkat( target: *const ::c_char, newdirfd: ::c_int, linkpath: *const ::c_char, ) -> ::c_int808 pub fn symlinkat( 809 target: *const ::c_char, 810 newdirfd: ::c_int, 811 linkpath: *const ::c_char, 812 ) -> ::c_int; unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int813 pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int; 814 access(path: *const c_char, amode: ::c_int) -> ::c_int815 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; alarm(seconds: ::c_uint) -> ::c_uint816 pub fn alarm(seconds: ::c_uint) -> ::c_uint; chdir(dir: *const c_char) -> ::c_int817 pub fn chdir(dir: *const c_char) -> ::c_int; fchdir(dirfd: ::c_int) -> ::c_int818 pub fn fchdir(dirfd: ::c_int) -> ::c_int; chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int819 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 820 #[cfg_attr( 821 all(target_os = "macos", target_arch = "x86"), 822 link_name = "lchown$UNIX2003" 823 )] lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int824 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 825 #[cfg_attr( 826 all(target_os = "macos", target_arch = "x86"), 827 link_name = "close$NOCANCEL$UNIX2003" 828 )] 829 #[cfg_attr( 830 all(target_os = "macos", target_arch = "x86_64"), 831 link_name = "close$NOCANCEL" 832 )] close(fd: ::c_int) -> ::c_int833 pub fn close(fd: ::c_int) -> ::c_int; dup(fd: ::c_int) -> ::c_int834 pub fn dup(fd: ::c_int) -> ::c_int; dup2(src: ::c_int, dst: ::c_int) -> ::c_int835 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int836 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int837 pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int838 pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int839 pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int; execve( prog: *const c_char, argv: *const *const c_char, envp: *const *const c_char, ) -> ::c_int840 pub fn execve( 841 prog: *const c_char, 842 argv: *const *const c_char, 843 envp: *const *const c_char, 844 ) -> ::c_int; execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int845 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; fork() -> pid_t846 pub fn fork() -> pid_t; fpathconf(filedes: ::c_int, name: ::c_int) -> c_long847 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char848 pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; getegid() -> gid_t849 pub fn getegid() -> gid_t; geteuid() -> uid_t850 pub fn geteuid() -> uid_t; getgid() -> gid_t851 pub fn getgid() -> gid_t; getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int852 pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int; 853 #[cfg_attr(target_os = "illumos", link_name = "getloginx")] getlogin() -> *mut c_char854 pub fn getlogin() -> *mut c_char; 855 #[cfg_attr( 856 all(target_os = "macos", target_arch = "x86"), 857 link_name = "getopt$UNIX2003" 858 )] getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int859 pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int; getpgid(pid: pid_t) -> pid_t860 pub fn getpgid(pid: pid_t) -> pid_t; getpgrp() -> pid_t861 pub fn getpgrp() -> pid_t; getpid() -> pid_t862 pub fn getpid() -> pid_t; getppid() -> pid_t863 pub fn getppid() -> pid_t; getuid() -> uid_t864 pub fn getuid() -> uid_t; isatty(fd: ::c_int) -> ::c_int865 pub fn isatty(fd: ::c_int) -> ::c_int; link(src: *const c_char, dst: *const c_char) -> ::c_int866 pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t867 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; pathconf(path: *const c_char, name: ::c_int) -> c_long868 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; pipe(fds: *mut ::c_int) -> ::c_int869 pub fn pipe(fds: *mut ::c_int) -> ::c_int; posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int870 pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int; 871 #[cfg_attr( 872 all(target_os = "macos", target_arch = "x86"), 873 link_name = "read$UNIX2003" 874 )] read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t875 pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t; rmdir(path: *const c_char) -> ::c_int876 pub fn rmdir(path: *const c_char) -> ::c_int; seteuid(uid: uid_t) -> ::c_int877 pub fn seteuid(uid: uid_t) -> ::c_int; setegid(gid: gid_t) -> ::c_int878 pub fn setegid(gid: gid_t) -> ::c_int; setgid(gid: gid_t) -> ::c_int879 pub fn setgid(gid: gid_t) -> ::c_int; setpgid(pid: pid_t, pgid: pid_t) -> ::c_int880 pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; setsid() -> pid_t881 pub fn setsid() -> pid_t; setuid(uid: uid_t) -> ::c_int882 pub fn setuid(uid: uid_t) -> ::c_int; 883 #[cfg_attr( 884 all(target_os = "macos", target_arch = "x86"), 885 link_name = "sleep$UNIX2003" 886 )] sleep(secs: ::c_uint) -> ::c_uint887 pub fn sleep(secs: ::c_uint) -> ::c_uint; 888 #[cfg_attr( 889 all(target_os = "macos", target_arch = "x86"), 890 link_name = "nanosleep$UNIX2003" 891 )] 892 #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")] nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int893 pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int; tcgetpgrp(fd: ::c_int) -> pid_t894 pub fn tcgetpgrp(fd: ::c_int) -> pid_t; tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int895 pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; ttyname(fd: ::c_int) -> *mut c_char896 pub fn ttyname(fd: ::c_int) -> *mut c_char; 897 #[cfg_attr( 898 all(target_os = "macos", target_arch = "x86"), 899 link_name = "ttyname_r$UNIX2003" 900 )] 901 #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")] ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int902 pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; unlink(c: *const c_char) -> ::c_int903 pub fn unlink(c: *const c_char) -> ::c_int; 904 #[cfg_attr( 905 all(target_os = "macos", target_arch = "x86"), 906 link_name = "wait$UNIX2003" 907 )] wait(status: *mut ::c_int) -> pid_t908 pub fn wait(status: *mut ::c_int) -> pid_t; 909 #[cfg_attr( 910 all(target_os = "macos", target_arch = "x86"), 911 link_name = "waitpid$UNIX2003" 912 )] waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t913 pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t; 914 #[cfg_attr( 915 all(target_os = "macos", target_arch = "x86"), 916 link_name = "write$UNIX2003" 917 )] write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t918 pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t; 919 #[cfg_attr( 920 all(target_os = "macos", target_arch = "x86"), 921 link_name = "pread$UNIX2003" 922 )] pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t923 pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; 924 #[cfg_attr( 925 all(target_os = "macos", target_arch = "x86"), 926 link_name = "pwrite$UNIX2003" 927 )] pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t928 pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; umask(mask: mode_t) -> mode_t929 pub fn umask(mask: mode_t) -> mode_t; 930 931 #[cfg_attr(target_os = "netbsd", link_name = "__utime50")] utime(file: *const c_char, buf: *const utimbuf) -> ::c_int932 pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; 933 934 #[cfg_attr( 935 all(target_os = "macos", target_arch = "x86"), 936 link_name = "kill$UNIX2003" 937 )] kill(pid: pid_t, sig: ::c_int) -> ::c_int938 pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; 939 #[cfg_attr( 940 all(target_os = "macos", target_arch = "x86"), 941 link_name = "killpg$UNIX2003" 942 )] killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int943 pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int; 944 mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int945 pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int946 pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; mlockall(flags: ::c_int) -> ::c_int947 pub fn mlockall(flags: ::c_int) -> ::c_int; munlockall() -> ::c_int948 pub fn munlockall() -> ::c_int; 949 950 #[cfg_attr( 951 all(target_os = "macos", target_arch = "x86"), 952 link_name = "mmap$UNIX2003" 953 )] mmap( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t, ) -> *mut ::c_void954 pub fn mmap( 955 addr: *mut ::c_void, 956 len: ::size_t, 957 prot: ::c_int, 958 flags: ::c_int, 959 fd: ::c_int, 960 offset: off_t, 961 ) -> *mut ::c_void; 962 #[cfg_attr( 963 all(target_os = "macos", target_arch = "x86"), 964 link_name = "munmap$UNIX2003" 965 )] munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int966 pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; 967 if_nametoindex(ifname: *const c_char) -> ::c_uint968 pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char969 pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char; 970 971 #[cfg_attr( 972 all(target_os = "macos", not(target_arch = "aarch64")), 973 link_name = "lstat$INODE64" 974 )] 975 #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] 976 #[cfg_attr( 977 all(target_os = "freebsd", any(freebsd11, freebsd10)), 978 link_name = "lstat@FBSD_1.0" 979 )] lstat(path: *const c_char, buf: *mut stat) -> ::c_int980 pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; 981 982 #[cfg_attr( 983 all(target_os = "macos", target_arch = "x86"), 984 link_name = "fsync$UNIX2003" 985 )] fsync(fd: ::c_int) -> ::c_int986 pub fn fsync(fd: ::c_int) -> ::c_int; 987 988 #[cfg_attr( 989 all(target_os = "macos", target_arch = "x86"), 990 link_name = "setenv$UNIX2003" 991 )] setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int992 pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int; 993 #[cfg_attr( 994 all(target_os = "macos", target_arch = "x86"), 995 link_name = "unsetenv$UNIX2003" 996 )] 997 #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")] unsetenv(name: *const c_char) -> ::c_int998 pub fn unsetenv(name: *const c_char) -> ::c_int; 999 symlink(path1: *const c_char, path2: *const c_char) -> ::c_int1000 pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int; 1001 ftruncate(fd: ::c_int, length: off_t) -> ::c_int1002 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; 1003 signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t1004 pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; 1005 1006 #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int1007 pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; 1008 1009 #[cfg_attr( 1010 any(target_os = "macos", target_os = "ios"), 1011 link_name = "realpath$DARWIN_EXTSN" 1012 )] realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char1013 pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char; 1014 flock(fd: ::c_int, operation: ::c_int) -> ::c_int1015 pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; 1016 1017 #[cfg_attr(target_os = "netbsd", link_name = "__times13")] times(buf: *mut ::tms) -> ::clock_t1018 pub fn times(buf: *mut ::tms) -> ::clock_t; 1019 pthread_self() -> ::pthread_t1020 pub fn pthread_self() -> ::pthread_t; 1021 #[cfg_attr( 1022 all(target_os = "macos", target_arch = "x86"), 1023 link_name = "pthread_join$UNIX2003" 1024 )] pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int1025 pub fn pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int; pthread_exit(value: *mut ::c_void) -> !1026 pub fn pthread_exit(value: *mut ::c_void) -> !; pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int1027 pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int1028 pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int; pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stack_size: ::size_t) -> ::c_int1029 pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stack_size: ::size_t) -> ::c_int; pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int1030 pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int; pthread_detach(thread: ::pthread_t) -> ::c_int1031 pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; 1032 #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")] sched_yield() -> ::c_int1033 pub fn sched_yield() -> ::c_int; pthread_key_create( key: *mut pthread_key_t, dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, ) -> ::c_int1034 pub fn pthread_key_create( 1035 key: *mut pthread_key_t, 1036 dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, 1037 ) -> ::c_int; pthread_key_delete(key: pthread_key_t) -> ::c_int1038 pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; pthread_getspecific(key: pthread_key_t) -> *mut ::c_void1039 pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int1040 pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int; pthread_mutex_init( lock: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t, ) -> ::c_int1041 pub fn pthread_mutex_init( 1042 lock: *mut pthread_mutex_t, 1043 attr: *const pthread_mutexattr_t, 1044 ) -> ::c_int; pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int1045 pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int1046 pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int1047 pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int1048 pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; 1049 pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int1050 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; 1051 #[cfg_attr( 1052 all(target_os = "macos", target_arch = "x86"), 1053 link_name = "pthread_mutexattr_destroy$UNIX2003" 1054 )] pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int1055 pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int; pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int1056 pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int; 1057 1058 #[cfg_attr( 1059 all(target_os = "macos", target_arch = "x86"), 1060 link_name = "pthread_cond_init$UNIX2003" 1061 )] pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> ::c_int1062 pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) 1063 -> ::c_int; 1064 #[cfg_attr( 1065 all(target_os = "macos", target_arch = "x86"), 1066 link_name = "pthread_cond_wait$UNIX2003" 1067 )] pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int1068 pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int; 1069 #[cfg_attr( 1070 all(target_os = "macos", target_arch = "x86"), 1071 link_name = "pthread_cond_timedwait$UNIX2003" 1072 )] pthread_cond_timedwait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1073 pub fn pthread_cond_timedwait( 1074 cond: *mut pthread_cond_t, 1075 lock: *mut pthread_mutex_t, 1076 abstime: *const ::timespec, 1077 ) -> ::c_int; pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int1078 pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int1079 pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int1080 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int1081 pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int; pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int1082 pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int; 1083 #[cfg_attr( 1084 all(target_os = "macos", target_arch = "x86"), 1085 link_name = "pthread_rwlock_init$UNIX2003" 1086 )] pthread_rwlock_init( lock: *mut pthread_rwlock_t, attr: *const pthread_rwlockattr_t, ) -> ::c_int1087 pub fn pthread_rwlock_init( 1088 lock: *mut pthread_rwlock_t, 1089 attr: *const pthread_rwlockattr_t, 1090 ) -> ::c_int; 1091 #[cfg_attr( 1092 all(target_os = "macos", target_arch = "x86"), 1093 link_name = "pthread_rwlock_destroy$UNIX2003" 1094 )] pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int1095 pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; 1096 #[cfg_attr( 1097 all(target_os = "macos", target_arch = "x86"), 1098 link_name = "pthread_rwlock_rdlock$UNIX2003" 1099 )] pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int1100 pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1101 #[cfg_attr( 1102 all(target_os = "macos", target_arch = "x86"), 1103 link_name = "pthread_rwlock_tryrdlock$UNIX2003" 1104 )] pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int1105 pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1106 #[cfg_attr( 1107 all(target_os = "macos", target_arch = "x86"), 1108 link_name = "pthread_rwlock_wrlock$UNIX2003" 1109 )] pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int1110 pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1111 #[cfg_attr( 1112 all(target_os = "macos", target_arch = "x86"), 1113 link_name = "pthread_rwlock_trywrlock$UNIX2003" 1114 )] pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int1115 pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1116 #[cfg_attr( 1117 all(target_os = "macos", target_arch = "x86"), 1118 link_name = "pthread_rwlock_unlock$UNIX2003" 1119 )] pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int1120 pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int1121 pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int; pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int1122 pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int; 1123 1124 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")] getsockopt( sockfd: ::c_int, level: ::c_int, optname: ::c_int, optval: *mut ::c_void, optlen: *mut ::socklen_t, ) -> ::c_int1125 pub fn getsockopt( 1126 sockfd: ::c_int, 1127 level: ::c_int, 1128 optname: ::c_int, 1129 optval: *mut ::c_void, 1130 optlen: *mut ::socklen_t, 1131 ) -> ::c_int; raise(signum: ::c_int) -> ::c_int1132 pub fn raise(signum: ::c_int) -> ::c_int; 1133 #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")] sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int1134 pub fn sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int; 1135 1136 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int1137 pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int; dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void1138 pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; dlerror() -> *mut ::c_char1139 pub fn dlerror() -> *mut ::c_char; dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void1140 pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void; dlclose(handle: *mut ::c_void) -> ::c_int1141 pub fn dlclose(handle: *mut ::c_void) -> ::c_int; dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int1142 pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; 1143 1144 #[cfg(not(all( 1145 libc_cfg_target_vendor, 1146 target_arch = "powerpc", 1147 target_vendor = "nintendo" 1148 )))] 1149 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")] getaddrinfo( node: *const c_char, service: *const c_char, hints: *const addrinfo, res: *mut *mut addrinfo, ) -> ::c_int1150 pub fn getaddrinfo( 1151 node: *const c_char, 1152 service: *const c_char, 1153 hints: *const addrinfo, 1154 res: *mut *mut addrinfo, 1155 ) -> ::c_int; 1156 #[cfg(not(all( 1157 libc_cfg_target_vendor, 1158 target_arch = "powerpc", 1159 target_vendor = "nintendo" 1160 )))] freeaddrinfo(res: *mut addrinfo)1161 pub fn freeaddrinfo(res: *mut addrinfo); gai_strerror(errcode: ::c_int) -> *const ::c_char1162 pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; 1163 #[cfg_attr( 1164 any( 1165 all(target_os = "linux", not(target_env = "musl")), 1166 target_os = "freebsd", 1167 target_os = "dragonfly", 1168 target_os = "haiku" 1169 ), 1170 link_name = "__res_init" 1171 )] 1172 #[cfg_attr(any(target_os = "macos", target_os = "ios"), link_name = "res_9_init")] res_init() -> ::c_int1173 pub fn res_init() -> ::c_int; 1174 1175 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] 1176 #[cfg_attr(target_env = "musl", allow(deprecated))] 1177 // FIXME: for `time_t` gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1178 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 1179 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] 1180 #[cfg_attr(target_env = "musl", allow(deprecated))] 1181 // FIXME: for `time_t` localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1182 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 1183 #[cfg_attr( 1184 all(target_os = "macos", target_arch = "x86"), 1185 link_name = "mktime$UNIX2003" 1186 )] 1187 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] 1188 #[cfg_attr(target_env = "musl", allow(deprecated))] 1189 // FIXME: for `time_t` mktime(tm: *mut tm) -> time_t1190 pub fn mktime(tm: *mut tm) -> time_t; 1191 #[cfg_attr(target_os = "netbsd", link_name = "__time50")] 1192 #[cfg_attr(target_env = "musl", allow(deprecated))] 1193 // FIXME: for `time_t` time(time: *mut time_t) -> time_t1194 pub fn time(time: *mut time_t) -> time_t; 1195 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")] 1196 #[cfg_attr(target_env = "musl", allow(deprecated))] 1197 // FIXME: for `time_t` gmtime(time_p: *const time_t) -> *mut tm1198 pub fn gmtime(time_p: *const time_t) -> *mut tm; 1199 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")] 1200 #[cfg_attr(target_env = "musl", allow(deprecated))] 1201 // FIXME: for `time_t` localtime(time_p: *const time_t) -> *mut tm1202 pub fn localtime(time_p: *const time_t) -> *mut tm; 1203 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")] 1204 #[cfg_attr(target_env = "musl", allow(deprecated))] 1205 // FIXME: for `time_t` difftime(time1: time_t, time0: time_t) -> ::c_double1206 pub fn difftime(time1: time_t, time0: time_t) -> ::c_double; 1207 #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] 1208 #[cfg_attr(target_env = "musl", allow(deprecated))] 1209 // FIXME: for `time_t` timegm(tm: *mut ::tm) -> time_t1210 pub fn timegm(tm: *mut ::tm) -> time_t; 1211 1212 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] 1213 #[cfg_attr( 1214 all(target_os = "freebsd", any(freebsd11, freebsd10)), 1215 link_name = "mknod@FBSD_1.0" 1216 )] mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int1217 pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int; gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1218 pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; endservent()1219 pub fn endservent(); getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent1220 pub fn getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent; getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent1221 pub fn getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent; getservent() -> *mut servent1222 pub fn getservent() -> *mut servent; setservent(stayopen: ::c_int)1223 pub fn setservent(stayopen: ::c_int); getprotobyname(name: *const ::c_char) -> *mut protoent1224 pub fn getprotobyname(name: *const ::c_char) -> *mut protoent; getprotobynumber(proto: ::c_int) -> *mut protoent1225 pub fn getprotobynumber(proto: ::c_int) -> *mut protoent; chroot(name: *const ::c_char) -> ::c_int1226 pub fn chroot(name: *const ::c_char) -> ::c_int; 1227 #[cfg_attr( 1228 all(target_os = "macos", target_arch = "x86"), 1229 link_name = "usleep$UNIX2003" 1230 )] usleep(secs: ::c_uint) -> ::c_int1231 pub fn usleep(secs: ::c_uint) -> ::c_int; 1232 #[cfg_attr( 1233 all(target_os = "macos", target_arch = "x86"), 1234 link_name = "send$UNIX2003" 1235 )] send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1236 pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 1237 #[cfg_attr( 1238 all(target_os = "macos", target_arch = "x86"), 1239 link_name = "recv$UNIX2003" 1240 )] recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1241 pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 1242 #[cfg_attr( 1243 all(target_os = "macos", target_arch = "x86"), 1244 link_name = "putenv$UNIX2003" 1245 )] 1246 #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")] putenv(string: *mut c_char) -> ::c_int1247 pub fn putenv(string: *mut c_char) -> ::c_int; 1248 #[cfg_attr( 1249 all(target_os = "macos", target_arch = "x86"), 1250 link_name = "poll$UNIX2003" 1251 )] poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1252 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; 1253 #[cfg_attr( 1254 all(target_os = "macos", target_arch = "x86_64"), 1255 link_name = "select$1050" 1256 )] 1257 #[cfg_attr( 1258 all(target_os = "macos", target_arch = "x86"), 1259 link_name = "select$UNIX2003" 1260 )] 1261 #[cfg_attr(target_os = "netbsd", link_name = "__select50")] select( nfds: ::c_int, readfs: *mut fd_set, writefds: *mut fd_set, errorfds: *mut fd_set, timeout: *mut timeval, ) -> ::c_int1262 pub fn select( 1263 nfds: ::c_int, 1264 readfs: *mut fd_set, 1265 writefds: *mut fd_set, 1266 errorfds: *mut fd_set, 1267 timeout: *mut timeval, 1268 ) -> ::c_int; 1269 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")] setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char1270 pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char; localeconv() -> *mut lconv1271 pub fn localeconv() -> *mut lconv; 1272 1273 #[cfg_attr( 1274 all(target_os = "macos", target_arch = "x86"), 1275 link_name = "sem_wait$UNIX2003" 1276 )] sem_wait(sem: *mut sem_t) -> ::c_int1277 pub fn sem_wait(sem: *mut sem_t) -> ::c_int; sem_trywait(sem: *mut sem_t) -> ::c_int1278 pub fn sem_trywait(sem: *mut sem_t) -> ::c_int; sem_post(sem: *mut sem_t) -> ::c_int1279 pub fn sem_post(sem: *mut sem_t) -> ::c_int; statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int1280 pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int1281 pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; 1282 readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t1283 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t; 1284 1285 #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")] sigemptyset(set: *mut sigset_t) -> ::c_int1286 pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; 1287 #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")] sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1288 pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 1289 #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")] sigfillset(set: *mut sigset_t) -> ::c_int1290 pub fn sigfillset(set: *mut sigset_t) -> ::c_int; 1291 #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")] sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1292 pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 1293 #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")] sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int1294 pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; 1295 1296 #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")] sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1297 pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int; 1298 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")] sigpending(set: *mut sigset_t) -> ::c_int1299 pub fn sigpending(set: *mut sigset_t) -> ::c_int; 1300 sysconf(name: ::c_int) -> ::c_long1301 pub fn sysconf(name: ::c_int) -> ::c_long; 1302 mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1303 pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; 1304 1305 #[cfg_attr( 1306 all(target_os = "macos", target_arch = "x86_64"), 1307 link_name = "pselect$1050" 1308 )] 1309 #[cfg_attr( 1310 all(target_os = "macos", target_arch = "x86"), 1311 link_name = "pselect$UNIX2003" 1312 )] 1313 #[cfg_attr(target_os = "netbsd", link_name = "__pselect50")] pselect( nfds: ::c_int, readfs: *mut fd_set, writefds: *mut fd_set, errorfds: *mut fd_set, timeout: *const timespec, sigmask: *const sigset_t, ) -> ::c_int1314 pub fn pselect( 1315 nfds: ::c_int, 1316 readfs: *mut fd_set, 1317 writefds: *mut fd_set, 1318 errorfds: *mut fd_set, 1319 timeout: *const timespec, 1320 sigmask: *const sigset_t, 1321 ) -> ::c_int; fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int1322 pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int; ftello(stream: *mut ::FILE) -> ::off_t1323 pub fn ftello(stream: *mut ::FILE) -> ::off_t; 1324 #[cfg_attr( 1325 all(target_os = "macos", target_arch = "x86"), 1326 link_name = "tcdrain$UNIX2003" 1327 )] tcdrain(fd: ::c_int) -> ::c_int1328 pub fn tcdrain(fd: ::c_int) -> ::c_int; cfgetispeed(termios: *const ::termios) -> ::speed_t1329 pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; cfgetospeed(termios: *const ::termios) -> ::speed_t1330 pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1331 pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1332 pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int1333 pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int1334 pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int; tcflow(fd: ::c_int, action: ::c_int) -> ::c_int1335 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; tcflush(fd: ::c_int, action: ::c_int) -> ::c_int1336 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; tcgetsid(fd: ::c_int) -> ::pid_t1337 pub fn tcgetsid(fd: ::c_int) -> ::pid_t; tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int1338 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; mkstemp(template: *mut ::c_char) -> ::c_int1339 pub fn mkstemp(template: *mut ::c_char) -> ::c_int; mkdtemp(template: *mut ::c_char) -> *mut ::c_char1340 pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; 1341 tmpnam(ptr: *mut ::c_char) -> *mut ::c_char1342 pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char; 1343 openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int)1344 pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); closelog()1345 pub fn closelog(); setlogmask(maskpri: ::c_int) -> ::c_int1346 pub fn setlogmask(maskpri: ::c_int) -> ::c_int; 1347 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")] syslog(priority: ::c_int, message: *const ::c_char, ...)1348 pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); 1349 #[cfg_attr( 1350 all(target_os = "macos", target_arch = "x86"), 1351 link_name = "nice$UNIX2003" 1352 )] nice(incr: ::c_int) -> ::c_int1353 pub fn nice(incr: ::c_int) -> ::c_int; 1354 grantpt(fd: ::c_int) -> ::c_int1355 pub fn grantpt(fd: ::c_int) -> ::c_int; posix_openpt(flags: ::c_int) -> ::c_int1356 pub fn posix_openpt(flags: ::c_int) -> ::c_int; ptsname(fd: ::c_int) -> *mut ::c_char1357 pub fn ptsname(fd: ::c_int) -> *mut ::c_char; unlockpt(fd: ::c_int) -> ::c_int1358 pub fn unlockpt(fd: ::c_int) -> ::c_int; 1359 strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char1360 pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char; getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t1361 pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t; 1362 lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int1363 pub fn lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int; 1364 } 1365 1366 cfg_if! { 1367 if #[cfg(not(target_env = "uclibc"))] { 1368 extern "C" { 1369 pub fn open_wmemstream( 1370 ptr: *mut *mut wchar_t, 1371 sizeloc: *mut size_t, 1372 ) -> *mut FILE; 1373 } 1374 } 1375 } 1376 1377 cfg_if! { 1378 if #[cfg(not(target_os = "redox"))] { 1379 extern { 1380 pub fn getsid(pid: pid_t) -> pid_t; 1381 pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; 1382 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 1383 link_name = "pause$UNIX2003")] 1384 pub fn pause() -> ::c_int; 1385 1386 pub fn readlinkat(dirfd: ::c_int, 1387 pathname: *const ::c_char, 1388 buf: *mut ::c_char, 1389 bufsiz: ::size_t) -> ::ssize_t; 1390 pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, 1391 mode: ::mode_t) -> ::c_int; 1392 pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, 1393 flags: ::c_int, ...) -> ::c_int; 1394 1395 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), 1396 link_name = "fdopendir$INODE64")] 1397 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 1398 link_name = "fdopendir$INODE64$UNIX2003")] 1399 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; 1400 1401 #[cfg_attr(all(target_os = "macos", not(target_arch = "aarch64")), 1402 link_name = "readdir_r$INODE64")] 1403 #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] 1404 #[cfg_attr( 1405 all(target_os = "freebsd", any(freebsd11, freebsd10)), 1406 link_name = "readdir_r@FBSD_1.0" 1407 )] 1408 #[allow(non_autolinks)] // FIXME: `<>` breaks line length limit. 1409 /// The 64-bit libc on Solaris and illumos only has readdir_r. If a 1410 /// 32-bit Solaris or illumos target is ever created, it should use 1411 /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: 1412 /// https://illumos.org/man/3lib/libc 1413 /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html 1414 /// https://www.unix.com/man-page/opensolaris/3LIB/libc/ 1415 pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, 1416 result: *mut *mut ::dirent) -> ::c_int; 1417 } 1418 } 1419 } 1420 1421 cfg_if! { 1422 if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] { 1423 extern { 1424 pub fn cfmakeraw(termios: *mut ::termios); 1425 pub fn cfsetspeed(termios: *mut ::termios, 1426 speed: ::speed_t) -> ::c_int; 1427 } 1428 } 1429 } 1430 1431 cfg_if! { 1432 if #[cfg(target_env = "newlib")] { 1433 mod newlib; 1434 pub use self::newlib::*; 1435 } else if #[cfg(any(target_os = "linux", 1436 target_os = "l4re", 1437 target_os = "android", 1438 target_os = "emscripten"))] { 1439 mod linux_like; 1440 pub use self::linux_like::*; 1441 } else if #[cfg(any(target_os = "macos", 1442 target_os = "ios", 1443 target_os = "freebsd", 1444 target_os = "dragonfly", 1445 target_os = "openbsd", 1446 target_os = "netbsd"))] { 1447 mod bsd; 1448 pub use self::bsd::*; 1449 } else if #[cfg(any(target_os = "solaris", 1450 target_os = "illumos"))] { 1451 mod solarish; 1452 pub use self::solarish::*; 1453 } else if #[cfg(target_os = "haiku")] { 1454 mod haiku; 1455 pub use self::haiku::*; 1456 } else if #[cfg(target_os = "hermit")] { 1457 mod hermit; 1458 pub use self::hermit::*; 1459 } else if #[cfg(target_os = "redox")] { 1460 mod redox; 1461 pub use self::redox::*; 1462 } else { 1463 // Unknown target_os 1464 } 1465 } 1466 1467 cfg_if! { 1468 if #[cfg(libc_core_cvoid)] { 1469 pub use ::ffi::c_void; 1470 } else { 1471 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help 1472 // enable more optimization opportunities around it recognizing things 1473 // like malloc/free. 1474 #[repr(u8)] 1475 #[allow(missing_copy_implementations)] 1476 #[allow(missing_debug_implementations)] 1477 pub enum c_void { 1478 // Two dummy variants so the #[repr] attribute can be used. 1479 #[doc(hidden)] 1480 __variant1, 1481 #[doc(hidden)] 1482 __variant2, 1483 } 1484 } 1485 } 1486 1487 cfg_if! { 1488 if #[cfg(libc_align)] { 1489 mod align; 1490 pub use self::align::*; 1491 } else { 1492 mod no_align; 1493 pub use self::no_align::*; 1494 } 1495 } 1496