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 = "illumos", target_os = "solaris")))] { 231 pub const IF_NAMESIZE: ::size_t = 16; 232 pub const IFNAMSIZ: ::size_t = IF_NAMESIZE; 233 } 234 } 235 236 pub const LOG_EMERG: ::c_int = 0; 237 pub const LOG_ALERT: ::c_int = 1; 238 pub const LOG_CRIT: ::c_int = 2; 239 pub const LOG_ERR: ::c_int = 3; 240 pub const LOG_WARNING: ::c_int = 4; 241 pub const LOG_NOTICE: ::c_int = 5; 242 pub const LOG_INFO: ::c_int = 6; 243 pub const LOG_DEBUG: ::c_int = 7; 244 245 pub const LOG_KERN: ::c_int = 0; 246 pub const LOG_USER: ::c_int = 1 << 3; 247 pub const LOG_MAIL: ::c_int = 2 << 3; 248 pub const LOG_DAEMON: ::c_int = 3 << 3; 249 pub const LOG_AUTH: ::c_int = 4 << 3; 250 pub const LOG_SYSLOG: ::c_int = 5 << 3; 251 pub const LOG_LPR: ::c_int = 6 << 3; 252 pub const LOG_NEWS: ::c_int = 7 << 3; 253 pub const LOG_UUCP: ::c_int = 8 << 3; 254 pub const LOG_LOCAL0: ::c_int = 16 << 3; 255 pub const LOG_LOCAL1: ::c_int = 17 << 3; 256 pub const LOG_LOCAL2: ::c_int = 18 << 3; 257 pub const LOG_LOCAL3: ::c_int = 19 << 3; 258 pub const LOG_LOCAL4: ::c_int = 20 << 3; 259 pub const LOG_LOCAL5: ::c_int = 21 << 3; 260 pub const LOG_LOCAL6: ::c_int = 22 << 3; 261 pub const LOG_LOCAL7: ::c_int = 23 << 3; 262 263 pub const LOG_PID: ::c_int = 0x01; 264 pub const LOG_CONS: ::c_int = 0x02; 265 pub const LOG_ODELAY: ::c_int = 0x04; 266 pub const LOG_NDELAY: ::c_int = 0x08; 267 pub const LOG_NOWAIT: ::c_int = 0x10; 268 269 pub const LOG_PRIMASK: ::c_int = 7; 270 pub const LOG_FACMASK: ::c_int = 0x3f8; 271 272 pub const PRIO_MIN: ::c_int = -20; 273 pub const PRIO_MAX: ::c_int = 20; 274 275 pub const IPPROTO_ICMP: ::c_int = 1; 276 pub const IPPROTO_ICMPV6: ::c_int = 58; 277 pub const IPPROTO_TCP: ::c_int = 6; 278 pub const IPPROTO_UDP: ::c_int = 17; 279 pub const IPPROTO_IP: ::c_int = 0; 280 pub const IPPROTO_IPV6: ::c_int = 41; 281 282 pub const INADDR_LOOPBACK: in_addr_t = 2130706433; 283 pub const INADDR_ANY: in_addr_t = 0; 284 pub const INADDR_BROADCAST: in_addr_t = 4294967295; 285 pub const INADDR_NONE: in_addr_t = 4294967295; 286 287 pub const ARPOP_REQUEST: u16 = 1; 288 pub const ARPOP_REPLY: u16 = 2; 289 290 pub const ATF_COM: ::c_int = 0x02; 291 pub const ATF_PERM: ::c_int = 0x04; 292 pub const ATF_PUBL: ::c_int = 0x08; 293 pub const ATF_USETRAILERS: ::c_int = 0x10; 294 295 cfg_if! { 296 if #[cfg(target_os = "l4re")] { 297 // required libraries for L4Re are linked externally, ATM 298 } else if #[cfg(feature = "std")] { 299 // cargo build, don't pull in anything extra as the libstd dep 300 // already pulls in all libs. 301 } else if #[cfg(target_env = "musl")] { 302 #[cfg_attr(feature = "rustc-dep-of-std", 303 link(name = "c", kind = "static", 304 cfg(target_feature = "crt-static")))] 305 #[cfg_attr(feature = "rustc-dep-of-std", 306 link(name = "c", cfg(not(target_feature = "crt-static"))))] 307 extern {} 308 } else if #[cfg(target_os = "emscripten")] { 309 #[link(name = "c")] 310 extern {} 311 } else if #[cfg(all(target_os = "netbsd", 312 feature = "rustc-dep-of-std", 313 target_vendor = "rumprun"))] { 314 // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled 315 // in automatically by the linker. We avoid passing it explicitly, as it 316 // causes some versions of binutils to crash with an assertion failure. 317 #[link(name = "m")] 318 extern {} 319 } else if #[cfg(any(target_os = "macos", 320 target_os = "ios", 321 target_os = "android", 322 target_os = "openbsd"))] { 323 #[link(name = "c")] 324 #[link(name = "m")] 325 extern {} 326 } else if #[cfg(target_os = "haiku")] { 327 #[link(name = "root")] 328 #[link(name = "network")] 329 extern {} 330 } else if #[cfg(target_env = "newlib")] { 331 #[link(name = "c")] 332 #[link(name = "m")] 333 extern {} 334 } else if #[cfg(target_os = "hermit")] { 335 // no_default_libraries is set to false for HermitCore, so only a link 336 // to "pthread" needs to be added. 337 #[link(name = "pthread")] 338 extern {} 339 } else if #[cfg(target_env = "illumos")] { 340 #[link(name = "c")] 341 #[link(name = "m")] 342 extern {} 343 } else if #[cfg(target_os = "redox")] { 344 #[cfg_attr(feature = "rustc-dep-of-std", 345 link(name = "c", kind = "static-nobundle", 346 cfg(target_feature = "crt-static")))] 347 #[cfg_attr(feature = "rustc-dep-of-std", 348 link(name = "c", cfg(not(target_feature = "crt-static"))))] 349 extern {} 350 } else { 351 #[link(name = "c")] 352 #[link(name = "m")] 353 #[link(name = "rt")] 354 #[link(name = "pthread")] 355 extern {} 356 } 357 } 358 359 #[cfg_attr(feature = "extra_traits", derive(Debug))] 360 pub enum FILE {} 361 impl ::Copy for FILE {} 362 impl ::Clone for FILE { clone(&self) -> FILE363 fn clone(&self) -> FILE { 364 *self 365 } 366 } 367 #[cfg_attr(feature = "extra_traits", derive(Debug))] 368 pub enum fpos_t {} // FIXME: fill this out with a struct 369 impl ::Copy for fpos_t {} 370 impl ::Clone for fpos_t { clone(&self) -> fpos_t371 fn clone(&self) -> fpos_t { 372 *self 373 } 374 } 375 376 extern "C" { isalnum(c: c_int) -> c_int377 pub fn isalnum(c: c_int) -> c_int; isalpha(c: c_int) -> c_int378 pub fn isalpha(c: c_int) -> c_int; iscntrl(c: c_int) -> c_int379 pub fn iscntrl(c: c_int) -> c_int; isdigit(c: c_int) -> c_int380 pub fn isdigit(c: c_int) -> c_int; isgraph(c: c_int) -> c_int381 pub fn isgraph(c: c_int) -> c_int; islower(c: c_int) -> c_int382 pub fn islower(c: c_int) -> c_int; isprint(c: c_int) -> c_int383 pub fn isprint(c: c_int) -> c_int; ispunct(c: c_int) -> c_int384 pub fn ispunct(c: c_int) -> c_int; isspace(c: c_int) -> c_int385 pub fn isspace(c: c_int) -> c_int; isupper(c: c_int) -> c_int386 pub fn isupper(c: c_int) -> c_int; isxdigit(c: c_int) -> c_int387 pub fn isxdigit(c: c_int) -> c_int; isblank(c: c_int) -> c_int388 pub fn isblank(c: c_int) -> c_int; tolower(c: c_int) -> c_int389 pub fn tolower(c: c_int) -> c_int; toupper(c: c_int) -> c_int390 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, >, )391 pub fn qsort( 392 base: *mut c_void, 393 num: size_t, 394 size: size_t, 395 compar: ::Option< 396 unsafe extern "C" fn(*const c_void, *const c_void) -> c_int, 397 >, 398 ); 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_void399 pub fn bsearch( 400 key: *const c_void, 401 base: *const c_void, 402 num: size_t, 403 size: size_t, 404 compar: ::Option< 405 unsafe extern "C" fn(*const c_void, *const c_void) -> c_int, 406 >, 407 ) -> *mut c_void; 408 #[cfg_attr( 409 all(target_os = "macos", target_arch = "x86"), 410 link_name = "fopen$UNIX2003" 411 )] fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE412 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; 413 #[cfg_attr( 414 all(target_os = "macos", target_arch = "x86"), 415 link_name = "freopen$UNIX2003" 416 )] freopen( filename: *const c_char, mode: *const c_char, file: *mut FILE, ) -> *mut FILE417 pub fn freopen( 418 filename: *const c_char, 419 mode: *const c_char, 420 file: *mut FILE, 421 ) -> *mut FILE; fflush(file: *mut FILE) -> c_int422 pub fn fflush(file: *mut FILE) -> c_int; fclose(file: *mut FILE) -> c_int423 pub fn fclose(file: *mut FILE) -> c_int; remove(filename: *const c_char) -> c_int424 pub fn remove(filename: *const c_char) -> c_int; rename(oldname: *const c_char, newname: *const c_char) -> c_int425 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; tmpfile() -> *mut FILE426 pub fn tmpfile() -> *mut FILE; setvbuf( stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t, ) -> c_int427 pub fn setvbuf( 428 stream: *mut FILE, 429 buffer: *mut c_char, 430 mode: c_int, 431 size: size_t, 432 ) -> c_int; setbuf(stream: *mut FILE, buf: *mut c_char)433 pub fn setbuf(stream: *mut FILE, buf: *mut c_char); getchar() -> c_int434 pub fn getchar() -> c_int; putchar(c: c_int) -> c_int435 pub fn putchar(c: c_int) -> c_int; fgetc(stream: *mut FILE) -> c_int436 pub fn fgetc(stream: *mut FILE) -> c_int; fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char437 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) 438 -> *mut c_char; fputc(c: c_int, stream: *mut FILE) -> c_int439 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; 440 #[cfg_attr( 441 all(target_os = "macos", target_arch = "x86"), 442 link_name = "fputs$UNIX2003" 443 )] fputs(s: *const c_char, stream: *mut FILE) -> c_int444 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int; puts(s: *const c_char) -> c_int445 pub fn puts(s: *const c_char) -> c_int; ungetc(c: c_int, stream: *mut FILE) -> c_int446 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_t447 pub fn fread( 448 ptr: *mut c_void, 449 size: size_t, 450 nobj: size_t, 451 stream: *mut FILE, 452 ) -> size_t; 453 #[cfg_attr( 454 all(target_os = "macos", target_arch = "x86"), 455 link_name = "fwrite$UNIX2003" 456 )] fwrite( ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE, ) -> size_t457 pub fn fwrite( 458 ptr: *const c_void, 459 size: size_t, 460 nobj: size_t, 461 stream: *mut FILE, 462 ) -> size_t; fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int463 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; ftell(stream: *mut FILE) -> c_long464 pub fn ftell(stream: *mut FILE) -> c_long; rewind(stream: *mut FILE)465 pub fn rewind(stream: *mut FILE); 466 #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int467 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; 468 #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int469 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; feof(stream: *mut FILE) -> c_int470 pub fn feof(stream: *mut FILE) -> c_int; ferror(stream: *mut FILE) -> c_int471 pub fn ferror(stream: *mut FILE) -> c_int; perror(s: *const c_char)472 pub fn perror(s: *const c_char); atoi(s: *const c_char) -> c_int473 pub fn atoi(s: *const c_char) -> c_int; 474 #[cfg_attr( 475 all(target_os = "macos", target_arch = "x86"), 476 link_name = "strtod$UNIX2003" 477 )] strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double478 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_long479 pub fn strtol( 480 s: *const c_char, 481 endp: *mut *mut c_char, 482 base: c_int, 483 ) -> c_long; strtoul( s: *const c_char, endp: *mut *mut c_char, base: c_int, ) -> c_ulong484 pub fn strtoul( 485 s: *const c_char, 486 endp: *mut *mut c_char, 487 base: c_int, 488 ) -> c_ulong; calloc(nobj: size_t, size: size_t) -> *mut c_void489 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; malloc(size: size_t) -> *mut c_void490 pub fn malloc(size: size_t) -> *mut c_void; realloc(p: *mut c_void, size: size_t) -> *mut c_void491 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; free(p: *mut c_void)492 pub fn free(p: *mut c_void); abort() -> !493 pub fn abort() -> !; exit(status: c_int) -> !494 pub fn exit(status: c_int) -> !; _exit(status: c_int) -> !495 pub fn _exit(status: c_int) -> !; atexit(cb: extern "C" fn()) -> c_int496 pub fn atexit(cb: extern "C" fn()) -> c_int; 497 #[cfg_attr( 498 all(target_os = "macos", target_arch = "x86"), 499 link_name = "system$UNIX2003" 500 )] system(s: *const c_char) -> c_int501 pub fn system(s: *const c_char) -> c_int; getenv(s: *const c_char) -> *mut c_char502 pub fn getenv(s: *const c_char) -> *mut c_char; 503 strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char504 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_char505 pub fn strncpy( 506 dst: *mut c_char, 507 src: *const c_char, 508 n: size_t, 509 ) -> *mut c_char; strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char510 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_char511 pub fn strncat( 512 s: *mut c_char, 513 ct: *const c_char, 514 n: size_t, 515 ) -> *mut c_char; strcmp(cs: *const c_char, ct: *const c_char) -> c_int516 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_int517 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_int518 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; strchr(cs: *const c_char, c: c_int) -> *mut c_char519 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; strrchr(cs: *const c_char, c: c_int) -> *mut c_char520 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; strspn(cs: *const c_char, ct: *const c_char) -> size_t521 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; strcspn(cs: *const c_char, ct: *const c_char) -> size_t522 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; strdup(cs: *const c_char) -> *mut c_char523 pub fn strdup(cs: *const c_char) -> *mut c_char; strndup(cs: *const c_char, n: size_t) -> *mut c_char524 pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char; strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char525 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_char526 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int527 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_int528 pub fn strncasecmp( 529 s1: *const c_char, 530 s2: *const c_char, 531 n: size_t, 532 ) -> c_int; strlen(cs: *const c_char) -> size_t533 pub fn strlen(cs: *const c_char) -> size_t; strnlen(cs: *const c_char, maxlen: size_t) -> size_t534 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 )] strerror(n: c_int) -> *mut c_char539 pub fn strerror(n: c_int) -> *mut c_char; strtok(s: *mut c_char, t: *const c_char) -> *mut c_char540 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_t541 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; strsignal(sig: c_int) -> *mut c_char542 pub fn strsignal(sig: c_int) -> *mut c_char; wcslen(buf: *const wchar_t) -> size_t543 pub fn wcslen(buf: *const wchar_t) -> size_t; wcstombs( dest: *mut c_char, src: *const wchar_t, n: size_t, ) -> ::size_t544 pub fn wcstombs( 545 dest: *mut c_char, 546 src: *const wchar_t, 547 n: size_t, 548 ) -> ::size_t; 549 memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void550 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_t551 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_int552 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_void553 pub fn memcpy( 554 dest: *mut c_void, 555 src: *const c_void, 556 n: size_t, 557 ) -> *mut c_void; memmove( dest: *mut c_void, src: *const c_void, n: size_t, ) -> *mut c_void558 pub fn memmove( 559 dest: *mut c_void, 560 src: *const c_void, 561 n: size_t, 562 ) -> *mut c_void; memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void563 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; 564 } 565 566 extern "C" { 567 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")] getpwnam(name: *const ::c_char) -> *mut passwd568 pub fn getpwnam(name: *const ::c_char) -> *mut passwd; 569 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")] getpwuid(uid: ::uid_t) -> *mut passwd570 pub fn getpwuid(uid: ::uid_t) -> *mut passwd; 571 fprintf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int572 pub fn fprintf( 573 stream: *mut ::FILE, 574 format: *const ::c_char, 575 ... 576 ) -> ::c_int; printf(format: *const ::c_char, ...) -> ::c_int577 pub fn printf(format: *const ::c_char, ...) -> ::c_int; snprintf( s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ... ) -> ::c_int578 pub fn snprintf( 579 s: *mut ::c_char, 580 n: ::size_t, 581 format: *const ::c_char, 582 ... 583 ) -> ::c_int; sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int584 pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; 585 #[cfg_attr(target_os = "linux", link_name = "__isoc99_fscanf")] fscanf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int586 pub fn fscanf( 587 stream: *mut ::FILE, 588 format: *const ::c_char, 589 ... 590 ) -> ::c_int; 591 #[cfg_attr(target_os = "linux", link_name = "__isoc99_scanf")] scanf(format: *const ::c_char, ...) -> ::c_int592 pub fn scanf(format: *const ::c_char, ...) -> ::c_int; 593 #[cfg_attr(target_os = "linux", link_name = "__isoc99_sscanf")] sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int594 pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) 595 -> ::c_int; getchar_unlocked() -> ::c_int596 pub fn getchar_unlocked() -> ::c_int; putchar_unlocked(c: ::c_int) -> ::c_int597 pub fn putchar_unlocked(c: ::c_int) -> ::c_int; 598 599 #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] 600 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")] socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int601 pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; 602 #[cfg_attr( 603 all(target_os = "macos", target_arch = "x86"), 604 link_name = "connect$UNIX2003" 605 )] 606 #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")] connect( socket: ::c_int, address: *const sockaddr, len: socklen_t, ) -> ::c_int607 pub fn connect( 608 socket: ::c_int, 609 address: *const sockaddr, 610 len: socklen_t, 611 ) -> ::c_int; 612 #[cfg_attr( 613 all(target_os = "macos", target_arch = "x86"), 614 link_name = "listen$UNIX2003" 615 )] listen(socket: ::c_int, backlog: ::c_int) -> ::c_int616 pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; 617 #[cfg_attr( 618 all(target_os = "macos", target_arch = "x86"), 619 link_name = "accept$UNIX2003" 620 )] accept( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int621 pub fn accept( 622 socket: ::c_int, 623 address: *mut sockaddr, 624 address_len: *mut socklen_t, 625 ) -> ::c_int; 626 #[cfg_attr( 627 all(target_os = "macos", target_arch = "x86"), 628 link_name = "getpeername$UNIX2003" 629 )] getpeername( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int630 pub fn getpeername( 631 socket: ::c_int, 632 address: *mut sockaddr, 633 address_len: *mut socklen_t, 634 ) -> ::c_int; 635 #[cfg_attr( 636 all(target_os = "macos", target_arch = "x86"), 637 link_name = "getsockname$UNIX2003" 638 )] getsockname( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int639 pub fn getsockname( 640 socket: ::c_int, 641 address: *mut sockaddr, 642 address_len: *mut socklen_t, 643 ) -> ::c_int; setsockopt( socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, option_len: socklen_t, ) -> ::c_int644 pub fn setsockopt( 645 socket: ::c_int, 646 level: ::c_int, 647 name: ::c_int, 648 value: *const ::c_void, 649 option_len: socklen_t, 650 ) -> ::c_int; 651 #[cfg_attr( 652 all(target_os = "macos", target_arch = "x86"), 653 link_name = "socketpair$UNIX2003" 654 )] 655 #[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_int656 pub fn socketpair( 657 domain: ::c_int, 658 type_: ::c_int, 659 protocol: ::c_int, 660 socket_vector: *mut ::c_int, 661 ) -> ::c_int; 662 #[cfg_attr( 663 all(target_os = "macos", target_arch = "x86"), 664 link_name = "sendto$UNIX2003" 665 )] 666 #[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_t667 pub fn sendto( 668 socket: ::c_int, 669 buf: *const ::c_void, 670 len: ::size_t, 671 flags: ::c_int, 672 addr: *const sockaddr, 673 addrlen: socklen_t, 674 ) -> ::ssize_t; shutdown(socket: ::c_int, how: ::c_int) -> ::c_int675 pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; 676 677 #[cfg_attr( 678 all(target_os = "macos", target_arch = "x86"), 679 link_name = "chmod$UNIX2003" 680 )] chmod(path: *const c_char, mode: mode_t) -> ::c_int681 pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; 682 #[cfg_attr( 683 all(target_os = "macos", target_arch = "x86"), 684 link_name = "fchmod$UNIX2003" 685 )] fchmod(fd: ::c_int, mode: mode_t) -> ::c_int686 pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; 687 688 #[cfg_attr( 689 all(target_os = "macos", not(target_arch = "aarch64")), 690 link_name = "fstat$INODE64" 691 )] 692 #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")] 693 #[cfg_attr( 694 all(target_os = "freebsd", any(freebsd11, freebsd10)), 695 link_name = "fstat@FBSD_1.0" 696 )] fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int697 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; 698 mkdir(path: *const c_char, mode: mode_t) -> ::c_int699 pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; 700 701 #[cfg_attr( 702 all(target_os = "macos", not(target_arch = "aarch64")), 703 link_name = "stat$INODE64" 704 )] 705 #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] 706 #[cfg_attr( 707 all(target_os = "freebsd", any(freebsd11, freebsd10)), 708 link_name = "stat@FBSD_1.0" 709 )] stat(path: *const c_char, buf: *mut stat) -> ::c_int710 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; 711 pclose(stream: *mut ::FILE) -> ::c_int712 pub fn pclose(stream: *mut ::FILE) -> ::c_int; 713 #[cfg_attr( 714 all(target_os = "macos", target_arch = "x86"), 715 link_name = "fdopen$UNIX2003" 716 )] fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE717 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; fileno(stream: *mut ::FILE) -> ::c_int718 pub fn fileno(stream: *mut ::FILE) -> ::c_int; 719 720 #[cfg_attr( 721 all(target_os = "macos", target_arch = "x86"), 722 link_name = "open$UNIX2003" 723 )] open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int724 pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; 725 #[cfg_attr( 726 all(target_os = "macos", target_arch = "x86"), 727 link_name = "creat$UNIX2003" 728 )] creat(path: *const c_char, mode: mode_t) -> ::c_int729 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; 730 #[cfg_attr( 731 all(target_os = "macos", target_arch = "x86"), 732 link_name = "fcntl$UNIX2003" 733 )] fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int734 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; 735 736 #[cfg_attr( 737 all(target_os = "macos", target_arch = "x86_64"), 738 link_name = "opendir$INODE64" 739 )] 740 #[cfg_attr( 741 all(target_os = "macos", target_arch = "x86"), 742 link_name = "opendir$INODE64$UNIX2003" 743 )] 744 #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] opendir(dirname: *const c_char) -> *mut ::DIR745 pub fn opendir(dirname: *const c_char) -> *mut ::DIR; 746 747 #[cfg_attr( 748 all(target_os = "macos", not(target_arch = "aarch64")), 749 link_name = "readdir$INODE64" 750 )] 751 #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")] 752 #[cfg_attr( 753 all(target_os = "freebsd", any(freebsd11, freebsd10)), 754 link_name = "readdir@FBSD_1.0" 755 )] readdir(dirp: *mut ::DIR) -> *mut ::dirent756 pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; 757 #[cfg_attr( 758 all(target_os = "macos", target_arch = "x86"), 759 link_name = "closedir$UNIX2003" 760 )] closedir(dirp: *mut ::DIR) -> ::c_int761 pub fn closedir(dirp: *mut ::DIR) -> ::c_int; 762 #[cfg_attr( 763 all(target_os = "macos", target_arch = "x86_64"), 764 link_name = "rewinddir$INODE64" 765 )] 766 #[cfg_attr( 767 all(target_os = "macos", target_arch = "x86"), 768 link_name = "rewinddir$INODE64$UNIX2003" 769 )] rewinddir(dirp: *mut ::DIR)770 pub fn rewinddir(dirp: *mut ::DIR); 771 fchmodat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, flags: ::c_int, ) -> ::c_int772 pub fn fchmodat( 773 dirfd: ::c_int, 774 pathname: *const ::c_char, 775 mode: ::mode_t, 776 flags: ::c_int, 777 ) -> ::c_int; fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int778 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_int779 pub fn fchownat( 780 dirfd: ::c_int, 781 pathname: *const ::c_char, 782 owner: ::uid_t, 783 group: ::gid_t, 784 flags: ::c_int, 785 ) -> ::c_int; 786 #[cfg_attr( 787 all(target_os = "macos", not(target_arch = "aarch64")), 788 link_name = "fstatat$INODE64" 789 )] 790 #[cfg_attr( 791 all(target_os = "freebsd", any(freebsd11, freebsd10)), 792 link_name = "fstatat@FBSD_1.1" 793 )] fstatat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int, ) -> ::c_int794 pub fn fstatat( 795 dirfd: ::c_int, 796 pathname: *const ::c_char, 797 buf: *mut stat, 798 flags: ::c_int, 799 ) -> ::c_int; linkat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int, ) -> ::c_int800 pub fn linkat( 801 olddirfd: ::c_int, 802 oldpath: *const ::c_char, 803 newdirfd: ::c_int, 804 newpath: *const ::c_char, 805 flags: ::c_int, 806 ) -> ::c_int; renameat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, ) -> ::c_int807 pub fn renameat( 808 olddirfd: ::c_int, 809 oldpath: *const ::c_char, 810 newdirfd: ::c_int, 811 newpath: *const ::c_char, 812 ) -> ::c_int; symlinkat( target: *const ::c_char, newdirfd: ::c_int, linkpath: *const ::c_char, ) -> ::c_int813 pub fn symlinkat( 814 target: *const ::c_char, 815 newdirfd: ::c_int, 816 linkpath: *const ::c_char, 817 ) -> ::c_int; unlinkat( dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ) -> ::c_int818 pub fn unlinkat( 819 dirfd: ::c_int, 820 pathname: *const ::c_char, 821 flags: ::c_int, 822 ) -> ::c_int; 823 access(path: *const c_char, amode: ::c_int) -> ::c_int824 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; alarm(seconds: ::c_uint) -> ::c_uint825 pub fn alarm(seconds: ::c_uint) -> ::c_uint; chdir(dir: *const c_char) -> ::c_int826 pub fn chdir(dir: *const c_char) -> ::c_int; fchdir(dirfd: ::c_int) -> ::c_int827 pub fn fchdir(dirfd: ::c_int) -> ::c_int; chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int828 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 829 #[cfg_attr( 830 all(target_os = "macos", target_arch = "x86"), 831 link_name = "lchown$UNIX2003" 832 )] lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int833 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 834 #[cfg_attr( 835 all(target_os = "macos", target_arch = "x86"), 836 link_name = "close$NOCANCEL$UNIX2003" 837 )] 838 #[cfg_attr( 839 all(target_os = "macos", target_arch = "x86_64"), 840 link_name = "close$NOCANCEL" 841 )] close(fd: ::c_int) -> ::c_int842 pub fn close(fd: ::c_int) -> ::c_int; dup(fd: ::c_int) -> ::c_int843 pub fn dup(fd: ::c_int) -> ::c_int; dup2(src: ::c_int, dst: ::c_int) -> ::c_int844 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int845 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; execle( path: *const ::c_char, arg0: *const ::c_char, ... ) -> ::c_int846 pub fn execle( 847 path: *const ::c_char, 848 arg0: *const ::c_char, 849 ... 850 ) -> ::c_int; execlp( file: *const ::c_char, arg0: *const ::c_char, ... ) -> ::c_int851 pub fn execlp( 852 file: *const ::c_char, 853 arg0: *const ::c_char, 854 ... 855 ) -> ::c_int; execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int856 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_int857 pub fn execve( 858 prog: *const c_char, 859 argv: *const *const c_char, 860 envp: *const *const c_char, 861 ) -> ::c_int; execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int862 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; fork() -> pid_t863 pub fn fork() -> pid_t; fpathconf(filedes: ::c_int, name: ::c_int) -> c_long864 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char865 pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; getegid() -> gid_t866 pub fn getegid() -> gid_t; geteuid() -> uid_t867 pub fn geteuid() -> uid_t; getgid() -> gid_t868 pub fn getgid() -> gid_t; getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int869 pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int; 870 #[cfg_attr(target_os = "illumos", link_name = "getloginx")] getlogin() -> *mut c_char871 pub fn getlogin() -> *mut c_char; 872 #[cfg_attr( 873 all(target_os = "macos", target_arch = "x86"), 874 link_name = "getopt$UNIX2003" 875 )] getopt( argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char, ) -> ::c_int876 pub fn getopt( 877 argc: ::c_int, 878 argv: *const *mut c_char, 879 optstr: *const c_char, 880 ) -> ::c_int; getpgid(pid: pid_t) -> pid_t881 pub fn getpgid(pid: pid_t) -> pid_t; getpgrp() -> pid_t882 pub fn getpgrp() -> pid_t; getpid() -> pid_t883 pub fn getpid() -> pid_t; getppid() -> pid_t884 pub fn getppid() -> pid_t; getuid() -> uid_t885 pub fn getuid() -> uid_t; isatty(fd: ::c_int) -> ::c_int886 pub fn isatty(fd: ::c_int) -> ::c_int; link(src: *const c_char, dst: *const c_char) -> ::c_int887 pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t888 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; pathconf(path: *const c_char, name: ::c_int) -> c_long889 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; pipe(fds: *mut ::c_int) -> ::c_int890 pub fn pipe(fds: *mut ::c_int) -> ::c_int; posix_memalign( memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t, ) -> ::c_int891 pub fn posix_memalign( 892 memptr: *mut *mut ::c_void, 893 align: ::size_t, 894 size: ::size_t, 895 ) -> ::c_int; 896 #[cfg_attr( 897 all(target_os = "macos", target_arch = "x86"), 898 link_name = "read$UNIX2003" 899 )] read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t900 pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) 901 -> ::ssize_t; rmdir(path: *const c_char) -> ::c_int902 pub fn rmdir(path: *const c_char) -> ::c_int; seteuid(uid: uid_t) -> ::c_int903 pub fn seteuid(uid: uid_t) -> ::c_int; setegid(gid: gid_t) -> ::c_int904 pub fn setegid(gid: gid_t) -> ::c_int; setgid(gid: gid_t) -> ::c_int905 pub fn setgid(gid: gid_t) -> ::c_int; setpgid(pid: pid_t, pgid: pid_t) -> ::c_int906 pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; setsid() -> pid_t907 pub fn setsid() -> pid_t; setuid(uid: uid_t) -> ::c_int908 pub fn setuid(uid: uid_t) -> ::c_int; 909 #[cfg_attr( 910 all(target_os = "macos", target_arch = "x86"), 911 link_name = "sleep$UNIX2003" 912 )] sleep(secs: ::c_uint) -> ::c_uint913 pub fn sleep(secs: ::c_uint) -> ::c_uint; 914 #[cfg_attr( 915 all(target_os = "macos", target_arch = "x86"), 916 link_name = "nanosleep$UNIX2003" 917 )] 918 #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")] nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int919 pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int; tcgetpgrp(fd: ::c_int) -> pid_t920 pub fn tcgetpgrp(fd: ::c_int) -> pid_t; tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int921 pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; ttyname(fd: ::c_int) -> *mut c_char922 pub fn ttyname(fd: ::c_int) -> *mut c_char; 923 #[cfg_attr( 924 all(target_os = "macos", target_arch = "x86"), 925 link_name = "ttyname_r$UNIX2003" 926 )] 927 #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")] ttyname_r( fd: ::c_int, buf: *mut c_char, buflen: ::size_t, ) -> ::c_int928 pub fn ttyname_r( 929 fd: ::c_int, 930 buf: *mut c_char, 931 buflen: ::size_t, 932 ) -> ::c_int; unlink(c: *const c_char) -> ::c_int933 pub fn unlink(c: *const c_char) -> ::c_int; 934 #[cfg_attr( 935 all(target_os = "macos", target_arch = "x86"), 936 link_name = "wait$UNIX2003" 937 )] wait(status: *mut ::c_int) -> pid_t938 pub fn wait(status: *mut ::c_int) -> pid_t; 939 #[cfg_attr( 940 all(target_os = "macos", target_arch = "x86"), 941 link_name = "waitpid$UNIX2003" 942 )] waitpid( pid: pid_t, status: *mut ::c_int, options: ::c_int, ) -> pid_t943 pub fn waitpid( 944 pid: pid_t, 945 status: *mut ::c_int, 946 options: ::c_int, 947 ) -> pid_t; 948 #[cfg_attr( 949 all(target_os = "macos", target_arch = "x86"), 950 link_name = "write$UNIX2003" 951 )] write( fd: ::c_int, buf: *const ::c_void, count: ::size_t, ) -> ::ssize_t952 pub fn write( 953 fd: ::c_int, 954 buf: *const ::c_void, 955 count: ::size_t, 956 ) -> ::ssize_t; 957 #[cfg_attr( 958 all(target_os = "macos", target_arch = "x86"), 959 link_name = "pread$UNIX2003" 960 )] pread( fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t, ) -> ::ssize_t961 pub fn pread( 962 fd: ::c_int, 963 buf: *mut ::c_void, 964 count: ::size_t, 965 offset: off_t, 966 ) -> ::ssize_t; 967 #[cfg_attr( 968 all(target_os = "macos", target_arch = "x86"), 969 link_name = "pwrite$UNIX2003" 970 )] pwrite( fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t, ) -> ::ssize_t971 pub fn pwrite( 972 fd: ::c_int, 973 buf: *const ::c_void, 974 count: ::size_t, 975 offset: off_t, 976 ) -> ::ssize_t; umask(mask: mode_t) -> mode_t977 pub fn umask(mask: mode_t) -> mode_t; 978 979 #[cfg_attr(target_os = "netbsd", link_name = "__utime50")] utime(file: *const c_char, buf: *const utimbuf) -> ::c_int980 pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; 981 982 #[cfg_attr( 983 all(target_os = "macos", target_arch = "x86"), 984 link_name = "kill$UNIX2003" 985 )] kill(pid: pid_t, sig: ::c_int) -> ::c_int986 pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; 987 #[cfg_attr( 988 all(target_os = "macos", target_arch = "x86"), 989 link_name = "killpg$UNIX2003" 990 )] killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int991 pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int; 992 mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int993 pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int994 pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; mlockall(flags: ::c_int) -> ::c_int995 pub fn mlockall(flags: ::c_int) -> ::c_int; munlockall() -> ::c_int996 pub fn munlockall() -> ::c_int; 997 998 #[cfg_attr( 999 all(target_os = "macos", target_arch = "x86"), 1000 link_name = "mmap$UNIX2003" 1001 )] mmap( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t, ) -> *mut ::c_void1002 pub fn mmap( 1003 addr: *mut ::c_void, 1004 len: ::size_t, 1005 prot: ::c_int, 1006 flags: ::c_int, 1007 fd: ::c_int, 1008 offset: off_t, 1009 ) -> *mut ::c_void; 1010 #[cfg_attr( 1011 all(target_os = "macos", target_arch = "x86"), 1012 link_name = "munmap$UNIX2003" 1013 )] munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int1014 pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; 1015 if_nametoindex(ifname: *const c_char) -> ::c_uint1016 pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; if_indextoname( ifindex: ::c_uint, ifname: *mut ::c_char, ) -> *mut ::c_char1017 pub fn if_indextoname( 1018 ifindex: ::c_uint, 1019 ifname: *mut ::c_char, 1020 ) -> *mut ::c_char; 1021 1022 #[cfg_attr( 1023 all(target_os = "macos", not(target_arch = "aarch64")), 1024 link_name = "lstat$INODE64" 1025 )] 1026 #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] 1027 #[cfg_attr( 1028 all(target_os = "freebsd", any(freebsd11, freebsd10)), 1029 link_name = "lstat@FBSD_1.0" 1030 )] lstat(path: *const c_char, buf: *mut stat) -> ::c_int1031 pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; 1032 1033 #[cfg_attr( 1034 all(target_os = "macos", target_arch = "x86"), 1035 link_name = "fsync$UNIX2003" 1036 )] fsync(fd: ::c_int) -> ::c_int1037 pub fn fsync(fd: ::c_int) -> ::c_int; 1038 1039 #[cfg_attr( 1040 all(target_os = "macos", target_arch = "x86"), 1041 link_name = "setenv$UNIX2003" 1042 )] setenv( name: *const c_char, val: *const c_char, overwrite: ::c_int, ) -> ::c_int1043 pub fn setenv( 1044 name: *const c_char, 1045 val: *const c_char, 1046 overwrite: ::c_int, 1047 ) -> ::c_int; 1048 #[cfg_attr( 1049 all(target_os = "macos", target_arch = "x86"), 1050 link_name = "unsetenv$UNIX2003" 1051 )] 1052 #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")] unsetenv(name: *const c_char) -> ::c_int1053 pub fn unsetenv(name: *const c_char) -> ::c_int; 1054 symlink(path1: *const c_char, path2: *const c_char) -> ::c_int1055 pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int; 1056 ftruncate(fd: ::c_int, length: off_t) -> ::c_int1057 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; 1058 signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t1059 pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; 1060 1061 #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int1062 pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; 1063 1064 #[cfg_attr( 1065 any(target_os = "macos", target_os = "ios"), 1066 link_name = "realpath$DARWIN_EXTSN" 1067 )] realpath( pathname: *const ::c_char, resolved: *mut ::c_char, ) -> *mut ::c_char1068 pub fn realpath( 1069 pathname: *const ::c_char, 1070 resolved: *mut ::c_char, 1071 ) -> *mut ::c_char; 1072 flock(fd: ::c_int, operation: ::c_int) -> ::c_int1073 pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; 1074 1075 #[cfg_attr(target_os = "netbsd", link_name = "__times13")] times(buf: *mut ::tms) -> ::clock_t1076 pub fn times(buf: *mut ::tms) -> ::clock_t; 1077 pthread_self() -> ::pthread_t1078 pub fn pthread_self() -> ::pthread_t; 1079 #[cfg_attr( 1080 all(target_os = "macos", target_arch = "x86"), 1081 link_name = "pthread_join$UNIX2003" 1082 )] pthread_join( native: ::pthread_t, value: *mut *mut ::c_void, ) -> ::c_int1083 pub fn pthread_join( 1084 native: ::pthread_t, 1085 value: *mut *mut ::c_void, 1086 ) -> ::c_int; pthread_exit(value: *mut ::c_void) -> !1087 pub fn pthread_exit(value: *mut ::c_void) -> !; pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int1088 pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int1089 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_int1090 pub fn pthread_attr_setstacksize( 1091 attr: *mut ::pthread_attr_t, 1092 stack_size: ::size_t, 1093 ) -> ::c_int; pthread_attr_setdetachstate( attr: *mut ::pthread_attr_t, state: ::c_int, ) -> ::c_int1094 pub fn pthread_attr_setdetachstate( 1095 attr: *mut ::pthread_attr_t, 1096 state: ::c_int, 1097 ) -> ::c_int; pthread_detach(thread: ::pthread_t) -> ::c_int1098 pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; 1099 #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")] sched_yield() -> ::c_int1100 pub fn sched_yield() -> ::c_int; pthread_key_create( key: *mut pthread_key_t, dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, ) -> ::c_int1101 pub fn pthread_key_create( 1102 key: *mut pthread_key_t, 1103 dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, 1104 ) -> ::c_int; pthread_key_delete(key: pthread_key_t) -> ::c_int1105 pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; pthread_getspecific(key: pthread_key_t) -> *mut ::c_void1106 pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; pthread_setspecific( key: pthread_key_t, value: *const ::c_void, ) -> ::c_int1107 pub fn pthread_setspecific( 1108 key: pthread_key_t, 1109 value: *const ::c_void, 1110 ) -> ::c_int; pthread_mutex_init( lock: *mut pthread_mutex_t, attr: *const pthread_mutexattr_t, ) -> ::c_int1111 pub fn pthread_mutex_init( 1112 lock: *mut pthread_mutex_t, 1113 attr: *const pthread_mutexattr_t, 1114 ) -> ::c_int; pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int1115 pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int1116 pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int1117 pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int1118 pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; 1119 pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int1120 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; 1121 #[cfg_attr( 1122 all(target_os = "macos", target_arch = "x86"), 1123 link_name = "pthread_mutexattr_destroy$UNIX2003" 1124 )] pthread_mutexattr_destroy( attr: *mut pthread_mutexattr_t, ) -> ::c_int1125 pub fn pthread_mutexattr_destroy( 1126 attr: *mut pthread_mutexattr_t, 1127 ) -> ::c_int; pthread_mutexattr_settype( attr: *mut pthread_mutexattr_t, _type: ::c_int, ) -> ::c_int1128 pub fn pthread_mutexattr_settype( 1129 attr: *mut pthread_mutexattr_t, 1130 _type: ::c_int, 1131 ) -> ::c_int; 1132 1133 #[cfg_attr( 1134 all(target_os = "macos", target_arch = "x86"), 1135 link_name = "pthread_cond_init$UNIX2003" 1136 )] pthread_cond_init( cond: *mut pthread_cond_t, attr: *const pthread_condattr_t, ) -> ::c_int1137 pub fn pthread_cond_init( 1138 cond: *mut pthread_cond_t, 1139 attr: *const pthread_condattr_t, 1140 ) -> ::c_int; 1141 #[cfg_attr( 1142 all(target_os = "macos", target_arch = "x86"), 1143 link_name = "pthread_cond_wait$UNIX2003" 1144 )] pthread_cond_wait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, ) -> ::c_int1145 pub fn pthread_cond_wait( 1146 cond: *mut pthread_cond_t, 1147 lock: *mut pthread_mutex_t, 1148 ) -> ::c_int; 1149 #[cfg_attr( 1150 all(target_os = "macos", target_arch = "x86"), 1151 link_name = "pthread_cond_timedwait$UNIX2003" 1152 )] pthread_cond_timedwait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1153 pub fn pthread_cond_timedwait( 1154 cond: *mut pthread_cond_t, 1155 lock: *mut pthread_mutex_t, 1156 abstime: *const ::timespec, 1157 ) -> ::c_int; pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int1158 pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int1159 pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int1160 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int1161 pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int; pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int1162 pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int; 1163 #[cfg_attr( 1164 all(target_os = "macos", target_arch = "x86"), 1165 link_name = "pthread_rwlock_init$UNIX2003" 1166 )] pthread_rwlock_init( lock: *mut pthread_rwlock_t, attr: *const pthread_rwlockattr_t, ) -> ::c_int1167 pub fn pthread_rwlock_init( 1168 lock: *mut pthread_rwlock_t, 1169 attr: *const pthread_rwlockattr_t, 1170 ) -> ::c_int; 1171 #[cfg_attr( 1172 all(target_os = "macos", target_arch = "x86"), 1173 link_name = "pthread_rwlock_destroy$UNIX2003" 1174 )] pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int1175 pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; 1176 #[cfg_attr( 1177 all(target_os = "macos", target_arch = "x86"), 1178 link_name = "pthread_rwlock_rdlock$UNIX2003" 1179 )] pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int1180 pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1181 #[cfg_attr( 1182 all(target_os = "macos", target_arch = "x86"), 1183 link_name = "pthread_rwlock_tryrdlock$UNIX2003" 1184 )] pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int1185 pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1186 #[cfg_attr( 1187 all(target_os = "macos", target_arch = "x86"), 1188 link_name = "pthread_rwlock_wrlock$UNIX2003" 1189 )] pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int1190 pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1191 #[cfg_attr( 1192 all(target_os = "macos", target_arch = "x86"), 1193 link_name = "pthread_rwlock_trywrlock$UNIX2003" 1194 )] pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int1195 pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1196 #[cfg_attr( 1197 all(target_os = "macos", target_arch = "x86"), 1198 link_name = "pthread_rwlock_unlock$UNIX2003" 1199 )] pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int1200 pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int1201 pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) 1202 -> ::c_int; pthread_rwlockattr_destroy( attr: *mut pthread_rwlockattr_t, ) -> ::c_int1203 pub fn pthread_rwlockattr_destroy( 1204 attr: *mut pthread_rwlockattr_t, 1205 ) -> ::c_int; 1206 1207 #[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_int1208 pub fn getsockopt( 1209 sockfd: ::c_int, 1210 level: ::c_int, 1211 optname: ::c_int, 1212 optval: *mut ::c_void, 1213 optlen: *mut ::socklen_t, 1214 ) -> ::c_int; raise(signum: ::c_int) -> ::c_int1215 pub fn raise(signum: ::c_int) -> ::c_int; 1216 #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")] sigaction( signum: ::c_int, act: *const sigaction, oldact: *mut sigaction, ) -> ::c_int1217 pub fn sigaction( 1218 signum: ::c_int, 1219 act: *const sigaction, 1220 oldact: *mut sigaction, 1221 ) -> ::c_int; 1222 1223 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] utimes( filename: *const ::c_char, times: *const ::timeval, ) -> ::c_int1224 pub fn utimes( 1225 filename: *const ::c_char, 1226 times: *const ::timeval, 1227 ) -> ::c_int; dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void1228 pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; dlerror() -> *mut ::c_char1229 pub fn dlerror() -> *mut ::c_char; dlsym( handle: *mut ::c_void, symbol: *const ::c_char, ) -> *mut ::c_void1230 pub fn dlsym( 1231 handle: *mut ::c_void, 1232 symbol: *const ::c_char, 1233 ) -> *mut ::c_void; dlclose(handle: *mut ::c_void) -> ::c_int1234 pub fn dlclose(handle: *mut ::c_void) -> ::c_int; dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int1235 pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; 1236 1237 #[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_int1238 pub fn getaddrinfo( 1239 node: *const c_char, 1240 service: *const c_char, 1241 hints: *const addrinfo, 1242 res: *mut *mut addrinfo, 1243 ) -> ::c_int; freeaddrinfo(res: *mut addrinfo)1244 pub fn freeaddrinfo(res: *mut addrinfo); gai_strerror(errcode: ::c_int) -> *const ::c_char1245 pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; 1246 #[cfg_attr( 1247 any( 1248 all(target_os = "linux", not(target_env = "musl")), 1249 target_os = "freebsd", 1250 target_os = "dragonfly", 1251 target_os = "haiku" 1252 ), 1253 link_name = "__res_init" 1254 )] 1255 #[cfg_attr( 1256 any(target_os = "macos", target_os = "ios"), 1257 link_name = "res_9_init" 1258 )] res_init() -> ::c_int1259 pub fn res_init() -> ::c_int; 1260 1261 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1262 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 1263 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1264 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 1265 #[cfg_attr( 1266 all(target_os = "macos", target_arch = "x86"), 1267 link_name = "mktime$UNIX2003" 1268 )] 1269 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] mktime(tm: *mut tm) -> time_t1270 pub fn mktime(tm: *mut tm) -> time_t; 1271 #[cfg_attr(target_os = "netbsd", link_name = "__time50")] time(time: *mut time_t) -> time_t1272 pub fn time(time: *mut time_t) -> time_t; 1273 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")] gmtime(time_p: *const time_t) -> *mut tm1274 pub fn gmtime(time_p: *const time_t) -> *mut tm; 1275 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")] localtime(time_p: *const time_t) -> *mut tm1276 pub fn localtime(time_p: *const time_t) -> *mut tm; 1277 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")] difftime(time1: time_t, time0: time_t) -> ::c_double1278 pub fn difftime(time1: time_t, time0: time_t) -> ::c_double; 1279 1280 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] 1281 #[cfg_attr( 1282 all(target_os = "freebsd", any(freebsd11, freebsd10)), 1283 link_name = "mknod@FBSD_1.0" 1284 )] mknod( pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t, ) -> ::c_int1285 pub fn mknod( 1286 pathname: *const ::c_char, 1287 mode: ::mode_t, 1288 dev: ::dev_t, 1289 ) -> ::c_int; gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1290 pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; getservbyname( name: *const ::c_char, proto: *const ::c_char, ) -> *mut servent1291 pub fn getservbyname( 1292 name: *const ::c_char, 1293 proto: *const ::c_char, 1294 ) -> *mut servent; getprotobyname(name: *const ::c_char) -> *mut protoent1295 pub fn getprotobyname(name: *const ::c_char) -> *mut protoent; getprotobynumber(proto: ::c_int) -> *mut protoent1296 pub fn getprotobynumber(proto: ::c_int) -> *mut protoent; chroot(name: *const ::c_char) -> ::c_int1297 pub fn chroot(name: *const ::c_char) -> ::c_int; 1298 #[cfg_attr( 1299 all(target_os = "macos", target_arch = "x86"), 1300 link_name = "usleep$UNIX2003" 1301 )] usleep(secs: ::c_uint) -> ::c_int1302 pub fn usleep(secs: ::c_uint) -> ::c_int; 1303 #[cfg_attr( 1304 all(target_os = "macos", target_arch = "x86"), 1305 link_name = "send$UNIX2003" 1306 )] send( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, ) -> ::ssize_t1307 pub fn send( 1308 socket: ::c_int, 1309 buf: *const ::c_void, 1310 len: ::size_t, 1311 flags: ::c_int, 1312 ) -> ::ssize_t; 1313 #[cfg_attr( 1314 all(target_os = "macos", target_arch = "x86"), 1315 link_name = "recv$UNIX2003" 1316 )] recv( socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, ) -> ::ssize_t1317 pub fn recv( 1318 socket: ::c_int, 1319 buf: *mut ::c_void, 1320 len: ::size_t, 1321 flags: ::c_int, 1322 ) -> ::ssize_t; 1323 #[cfg_attr( 1324 all(target_os = "macos", target_arch = "x86"), 1325 link_name = "putenv$UNIX2003" 1326 )] 1327 #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")] putenv(string: *mut c_char) -> ::c_int1328 pub fn putenv(string: *mut c_char) -> ::c_int; 1329 #[cfg_attr( 1330 all(target_os = "macos", target_arch = "x86"), 1331 link_name = "poll$UNIX2003" 1332 )] poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1333 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; 1334 #[cfg_attr( 1335 all(target_os = "macos", target_arch = "x86_64"), 1336 link_name = "select$1050" 1337 )] 1338 #[cfg_attr( 1339 all(target_os = "macos", target_arch = "x86"), 1340 link_name = "select$UNIX2003" 1341 )] 1342 #[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_int1343 pub fn select( 1344 nfds: ::c_int, 1345 readfs: *mut fd_set, 1346 writefds: *mut fd_set, 1347 errorfds: *mut fd_set, 1348 timeout: *mut timeval, 1349 ) -> ::c_int; 1350 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")] setlocale( category: ::c_int, locale: *const ::c_char, ) -> *mut ::c_char1351 pub fn setlocale( 1352 category: ::c_int, 1353 locale: *const ::c_char, 1354 ) -> *mut ::c_char; localeconv() -> *mut lconv1355 pub fn localeconv() -> *mut lconv; 1356 1357 #[cfg_attr( 1358 all(target_os = "macos", target_arch = "x86"), 1359 link_name = "sem_wait$UNIX2003" 1360 )] sem_wait(sem: *mut sem_t) -> ::c_int1361 pub fn sem_wait(sem: *mut sem_t) -> ::c_int; sem_trywait(sem: *mut sem_t) -> ::c_int1362 pub fn sem_trywait(sem: *mut sem_t) -> ::c_int; sem_post(sem: *mut sem_t) -> ::c_int1363 pub fn sem_post(sem: *mut sem_t) -> ::c_int; statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int1364 pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int1365 pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; 1366 readlink( path: *const c_char, buf: *mut c_char, bufsz: ::size_t, ) -> ::ssize_t1367 pub fn readlink( 1368 path: *const c_char, 1369 buf: *mut c_char, 1370 bufsz: ::size_t, 1371 ) -> ::ssize_t; 1372 1373 #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")] sigemptyset(set: *mut sigset_t) -> ::c_int1374 pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; 1375 #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")] sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1376 pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 1377 #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")] sigfillset(set: *mut sigset_t) -> ::c_int1378 pub fn sigfillset(set: *mut sigset_t) -> ::c_int; 1379 #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")] sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1380 pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 1381 #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")] sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int1382 pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; 1383 1384 #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")] sigprocmask( how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t, ) -> ::c_int1385 pub fn sigprocmask( 1386 how: ::c_int, 1387 set: *const sigset_t, 1388 oldset: *mut sigset_t, 1389 ) -> ::c_int; 1390 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")] sigpending(set: *mut sigset_t) -> ::c_int1391 pub fn sigpending(set: *mut sigset_t) -> ::c_int; 1392 1393 #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] timegm(tm: *mut ::tm) -> time_t1394 pub fn timegm(tm: *mut ::tm) -> time_t; 1395 sysconf(name: ::c_int) -> ::c_long1396 pub fn sysconf(name: ::c_int) -> ::c_long; 1397 mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1398 pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; 1399 1400 #[cfg_attr( 1401 all(target_os = "macos", target_arch = "x86_64"), 1402 link_name = "pselect$1050" 1403 )] 1404 #[cfg_attr( 1405 all(target_os = "macos", target_arch = "x86"), 1406 link_name = "pselect$UNIX2003" 1407 )] 1408 #[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_int1409 pub fn pselect( 1410 nfds: ::c_int, 1411 readfs: *mut fd_set, 1412 writefds: *mut fd_set, 1413 errorfds: *mut fd_set, 1414 timeout: *const timespec, 1415 sigmask: *const sigset_t, 1416 ) -> ::c_int; fseeko( stream: *mut ::FILE, offset: ::off_t, whence: ::c_int, ) -> ::c_int1417 pub fn fseeko( 1418 stream: *mut ::FILE, 1419 offset: ::off_t, 1420 whence: ::c_int, 1421 ) -> ::c_int; ftello(stream: *mut ::FILE) -> ::off_t1422 pub fn ftello(stream: *mut ::FILE) -> ::off_t; 1423 #[cfg_attr( 1424 all(target_os = "macos", target_arch = "x86"), 1425 link_name = "tcdrain$UNIX2003" 1426 )] tcdrain(fd: ::c_int) -> ::c_int1427 pub fn tcdrain(fd: ::c_int) -> ::c_int; cfgetispeed(termios: *const ::termios) -> ::speed_t1428 pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; cfgetospeed(termios: *const ::termios) -> ::speed_t1429 pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1430 pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1431 pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int1432 pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; tcsetattr( fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios, ) -> ::c_int1433 pub fn tcsetattr( 1434 fd: ::c_int, 1435 optional_actions: ::c_int, 1436 termios: *const ::termios, 1437 ) -> ::c_int; tcflow(fd: ::c_int, action: ::c_int) -> ::c_int1438 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; tcflush(fd: ::c_int, action: ::c_int) -> ::c_int1439 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; tcgetsid(fd: ::c_int) -> ::pid_t1440 pub fn tcgetsid(fd: ::c_int) -> ::pid_t; tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int1441 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; mkstemp(template: *mut ::c_char) -> ::c_int1442 pub fn mkstemp(template: *mut ::c_char) -> ::c_int; mkdtemp(template: *mut ::c_char) -> *mut ::c_char1443 pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; 1444 tmpnam(ptr: *mut ::c_char) -> *mut ::c_char1445 pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char; 1446 openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int)1447 pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); closelog()1448 pub fn closelog(); setlogmask(maskpri: ::c_int) -> ::c_int1449 pub fn setlogmask(maskpri: ::c_int) -> ::c_int; 1450 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")] syslog(priority: ::c_int, message: *const ::c_char, ...)1451 pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); 1452 #[cfg_attr( 1453 all(target_os = "macos", target_arch = "x86"), 1454 link_name = "nice$UNIX2003" 1455 )] nice(incr: ::c_int) -> ::c_int1456 pub fn nice(incr: ::c_int) -> ::c_int; 1457 grantpt(fd: ::c_int) -> ::c_int1458 pub fn grantpt(fd: ::c_int) -> ::c_int; posix_openpt(flags: ::c_int) -> ::c_int1459 pub fn posix_openpt(flags: ::c_int) -> ::c_int; ptsname(fd: ::c_int) -> *mut ::c_char1460 pub fn ptsname(fd: ::c_int) -> *mut ::c_char; unlockpt(fd: ::c_int) -> ::c_int1461 pub fn unlockpt(fd: ::c_int) -> ::c_int; 1462 strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char1463 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_t1464 pub fn getline( 1465 lineptr: *mut *mut c_char, 1466 n: *mut size_t, 1467 stream: *mut FILE, 1468 ) -> ssize_t; 1469 lockf( fd: ::c_int, cmd: ::c_int, len: ::off_t, ) -> ::c_int1470 pub fn lockf( 1471 fd: ::c_int, 1472 cmd: ::c_int, 1473 len: ::off_t, 1474 ) -> ::c_int; 1475 } 1476 1477 cfg_if! { 1478 if #[cfg(not(target_os = "redox"))] { 1479 extern { 1480 pub fn getsid(pid: pid_t) -> pid_t; 1481 pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; 1482 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 1483 link_name = "pause$UNIX2003")] 1484 pub fn pause() -> ::c_int; 1485 1486 pub fn readlinkat(dirfd: ::c_int, 1487 pathname: *const ::c_char, 1488 buf: *mut ::c_char, 1489 bufsiz: ::size_t) -> ::ssize_t; 1490 pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, 1491 mode: ::mode_t) -> ::c_int; 1492 pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, 1493 flags: ::c_int, ...) -> ::c_int; 1494 1495 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), 1496 link_name = "fdopendir$INODE64")] 1497 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 1498 link_name = "fdopendir$INODE64$UNIX2003")] 1499 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; 1500 1501 #[cfg_attr(all(target_os = "macos", not(target_arch = "aarch64")), 1502 link_name = "readdir_r$INODE64")] 1503 #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] 1504 #[cfg_attr( 1505 all(target_os = "freebsd", any(freebsd11, freebsd10)), 1506 link_name = "readdir_r@FBSD_1.0" 1507 )] 1508 /// The 64-bit libc on Solaris and illumos only has readdir_r. If a 1509 /// 32-bit Solaris or illumos target is ever created, it should use 1510 /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: 1511 /// https://illumos.org/man/3lib/libc 1512 /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html 1513 /// https://www.unix.com/man-page/opensolaris/3LIB/libc/ 1514 pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, 1515 result: *mut *mut ::dirent) -> ::c_int; 1516 } 1517 } 1518 } 1519 1520 cfg_if! { 1521 if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] { 1522 extern { 1523 pub fn cfmakeraw(termios: *mut ::termios); 1524 pub fn cfsetspeed(termios: *mut ::termios, 1525 speed: ::speed_t) -> ::c_int; 1526 } 1527 } 1528 } 1529 1530 cfg_if! { 1531 if #[cfg(target_env = "uclibc")] { 1532 mod uclibc; 1533 pub use self::uclibc::*; 1534 } else if #[cfg(target_env = "newlib")] { 1535 mod newlib; 1536 pub use self::newlib::*; 1537 } else if #[cfg(any(target_os = "linux", 1538 target_os = "android", 1539 target_os = "emscripten"))] { 1540 mod linux_like; 1541 pub use self::linux_like::*; 1542 } else if #[cfg(any(target_os = "macos", 1543 target_os = "ios", 1544 target_os = "freebsd", 1545 target_os = "dragonfly", 1546 target_os = "openbsd", 1547 target_os = "netbsd"))] { 1548 mod bsd; 1549 pub use self::bsd::*; 1550 } else if #[cfg(any(target_os = "solaris", 1551 target_os = "illumos"))] { 1552 mod solarish; 1553 pub use self::solarish::*; 1554 } else if #[cfg(target_os = "haiku")] { 1555 mod haiku; 1556 pub use self::haiku::*; 1557 } else if #[cfg(target_os = "hermit")] { 1558 mod hermit; 1559 pub use self::hermit::*; 1560 } else if #[cfg(target_os = "redox")] { 1561 mod redox; 1562 pub use self::redox::*; 1563 } else { 1564 // Unknown target_os 1565 } 1566 } 1567 1568 cfg_if! { 1569 if #[cfg(libc_core_cvoid)] { 1570 pub use ::ffi::c_void; 1571 } else { 1572 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help 1573 // enable more optimization opportunities around it recognizing things 1574 // like malloc/free. 1575 #[repr(u8)] 1576 #[allow(missing_copy_implementations)] 1577 #[allow(missing_debug_implementations)] 1578 pub enum c_void { 1579 // Two dummy variants so the #[repr] attribute can be used. 1580 #[doc(hidden)] 1581 __variant1, 1582 #[doc(hidden)] 1583 __variant2, 1584 } 1585 } 1586 } 1587 1588 cfg_if! { 1589 if #[cfg(libc_align)] { 1590 mod align; 1591 pub use self::align::*; 1592 } else { 1593 mod no_align; 1594 pub use self::no_align::*; 1595 } 1596 } 1597