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(any(target_os = "l4re", target_os = "espidf"))] { 301 // required libraries for L4Re and the ESP-IDF framework 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", modifiers = "-bundle", 309 cfg(target_feature = "crt-static"))] 310 #[link(name = "rt", kind = "static", modifiers = "-bundle", 311 cfg(target_feature = "crt-static"))] 312 #[link(name = "pthread", kind = "static", modifiers = "-bundle", 313 cfg(target_feature = "crt-static"))] 314 #[link(name = "m", kind = "static", modifiers = "-bundle", 315 cfg(target_feature = "crt-static"))] 316 #[link(name = "dl", kind = "static", modifiers = "-bundle", 317 cfg(target_feature = "crt-static"))] 318 #[link(name = "c", kind = "static", modifiers = "-bundle", 319 cfg(target_feature = "crt-static"))] 320 #[link(name = "gcc_eh", kind = "static", modifiers = "-bundle", 321 cfg(target_feature = "crt-static"))] 322 #[link(name = "gcc", kind = "static", modifiers = "-bundle", 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", modifiers = "-bundle", 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", modifiers = "-bundle", 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; strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float489 pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long490 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_ulong491 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_void492 pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void; malloc(size: size_t) -> *mut c_void493 pub fn malloc(size: size_t) -> *mut c_void; realloc(p: *mut c_void, size: size_t) -> *mut c_void494 pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void; free(p: *mut c_void)495 pub fn free(p: *mut c_void); abort() -> !496 pub fn abort() -> !; exit(status: c_int) -> !497 pub fn exit(status: c_int) -> !; _exit(status: c_int) -> !498 pub fn _exit(status: c_int) -> !; atexit(cb: extern "C" fn()) -> c_int499 pub fn atexit(cb: extern "C" fn()) -> c_int; 500 #[cfg_attr( 501 all(target_os = "macos", target_arch = "x86"), 502 link_name = "system$UNIX2003" 503 )] system(s: *const c_char) -> c_int504 pub fn system(s: *const c_char) -> c_int; getenv(s: *const c_char) -> *mut c_char505 pub fn getenv(s: *const c_char) -> *mut c_char; 506 strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char507 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_char508 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_char509 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_char510 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_int511 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_int512 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_int513 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; strchr(cs: *const c_char, c: c_int) -> *mut c_char514 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; strrchr(cs: *const c_char, c: c_int) -> *mut c_char515 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; strspn(cs: *const c_char, ct: *const c_char) -> size_t516 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; strcspn(cs: *const c_char, ct: *const c_char) -> size_t517 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; strdup(cs: *const c_char) -> *mut c_char518 pub fn strdup(cs: *const c_char) -> *mut c_char; strndup(cs: *const c_char, n: size_t) -> *mut c_char519 pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char; strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char520 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_char521 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int522 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_int523 pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int; strlen(cs: *const c_char) -> size_t524 pub fn strlen(cs: *const c_char) -> size_t; strnlen(cs: *const c_char, maxlen: size_t) -> size_t525 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; 526 #[cfg_attr( 527 all(target_os = "macos", target_arch = "x86"), 528 link_name = "strerror$UNIX2003" 529 )] strerror(n: c_int) -> *mut c_char530 pub fn strerror(n: c_int) -> *mut c_char; strtok(s: *mut c_char, t: *const c_char) -> *mut c_char531 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_t532 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; strsignal(sig: c_int) -> *mut c_char533 pub fn strsignal(sig: c_int) -> *mut c_char; wcslen(buf: *const wchar_t) -> size_t534 pub fn wcslen(buf: *const wchar_t) -> size_t; wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t535 pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t; 536 memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void537 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_t538 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_int539 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_void540 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_void541 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_void542 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; 543 } 544 545 extern "C" { 546 #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")] getpwnam(name: *const ::c_char) -> *mut passwd547 pub fn getpwnam(name: *const ::c_char) -> *mut passwd; 548 #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")] getpwuid(uid: ::uid_t) -> *mut passwd549 pub fn getpwuid(uid: ::uid_t) -> *mut passwd; 550 fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int551 pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; printf(format: *const ::c_char, ...) -> ::c_int552 pub fn printf(format: *const ::c_char, ...) -> ::c_int; snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int553 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_int554 pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; 555 #[cfg_attr( 556 all(target_os = "linux", not(target_env = "uclibc")), 557 link_name = "__isoc99_fscanf" 558 )] fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int559 pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; 560 #[cfg_attr( 561 all(target_os = "linux", not(target_env = "uclibc")), 562 link_name = "__isoc99_scanf" 563 )] scanf(format: *const ::c_char, ...) -> ::c_int564 pub fn scanf(format: *const ::c_char, ...) -> ::c_int; 565 #[cfg_attr( 566 all(target_os = "linux", not(target_env = "uclibc")), 567 link_name = "__isoc99_sscanf" 568 )] sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int569 pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int; getchar_unlocked() -> ::c_int570 pub fn getchar_unlocked() -> ::c_int; putchar_unlocked(c: ::c_int) -> ::c_int571 pub fn putchar_unlocked(c: ::c_int) -> ::c_int; 572 573 #[cfg(not(all( 574 libc_cfg_target_vendor, 575 target_arch = "powerpc", 576 target_vendor = "nintendo" 577 )))] 578 #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] 579 #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")] 580 #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")] socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int581 pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; 582 #[cfg(not(all( 583 libc_cfg_target_vendor, 584 target_arch = "powerpc", 585 target_vendor = "nintendo" 586 )))] 587 #[cfg_attr( 588 all(target_os = "macos", target_arch = "x86"), 589 link_name = "connect$UNIX2003" 590 )] 591 #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")] 592 #[cfg_attr(target_os = "espidf", link_name = "lwip_connect")] connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int593 pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int; 594 #[cfg_attr( 595 all(target_os = "macos", target_arch = "x86"), 596 link_name = "listen$UNIX2003" 597 )] 598 #[cfg_attr(target_os = "espidf", link_name = "lwip_listen")] listen(socket: ::c_int, backlog: ::c_int) -> ::c_int599 pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; 600 #[cfg(not(all( 601 libc_cfg_target_vendor, 602 target_arch = "powerpc", 603 target_vendor = "nintendo" 604 )))] 605 #[cfg_attr( 606 all(target_os = "macos", target_arch = "x86"), 607 link_name = "accept$UNIX2003" 608 )] 609 #[cfg_attr(target_os = "espidf", link_name = "lwip_accept")] accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int610 pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int; 611 #[cfg(not(all( 612 libc_cfg_target_vendor, 613 target_arch = "powerpc", 614 target_vendor = "nintendo" 615 )))] 616 #[cfg_attr( 617 all(target_os = "macos", target_arch = "x86"), 618 link_name = "getpeername$UNIX2003" 619 )] 620 #[cfg_attr(target_os = "espidf", link_name = "lwip_getpeername")] getpeername( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int621 pub fn getpeername( 622 socket: ::c_int, 623 address: *mut sockaddr, 624 address_len: *mut socklen_t, 625 ) -> ::c_int; 626 #[cfg(not(all( 627 libc_cfg_target_vendor, 628 target_arch = "powerpc", 629 target_vendor = "nintendo" 630 )))] 631 #[cfg_attr( 632 all(target_os = "macos", target_arch = "x86"), 633 link_name = "getsockname$UNIX2003" 634 )] 635 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockname")] getsockname( socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t, ) -> ::c_int636 pub fn getsockname( 637 socket: ::c_int, 638 address: *mut sockaddr, 639 address_len: *mut socklen_t, 640 ) -> ::c_int; 641 #[cfg_attr(target_os = "espidf", link_name = "lwip_setsockopt")] setsockopt( socket: ::c_int, level: ::c_int, name: ::c_int, value: *const ::c_void, option_len: socklen_t, ) -> ::c_int642 pub fn setsockopt( 643 socket: ::c_int, 644 level: ::c_int, 645 name: ::c_int, 646 value: *const ::c_void, 647 option_len: socklen_t, 648 ) -> ::c_int; 649 #[cfg_attr( 650 all(target_os = "macos", target_arch = "x86"), 651 link_name = "socketpair$UNIX2003" 652 )] 653 #[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_int654 pub fn socketpair( 655 domain: ::c_int, 656 type_: ::c_int, 657 protocol: ::c_int, 658 socket_vector: *mut ::c_int, 659 ) -> ::c_int; 660 #[cfg(not(all( 661 libc_cfg_target_vendor, 662 target_arch = "powerpc", 663 target_vendor = "nintendo" 664 )))] 665 #[cfg_attr( 666 all(target_os = "macos", target_arch = "x86"), 667 link_name = "sendto$UNIX2003" 668 )] 669 #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")] 670 #[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")] sendto( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, addr: *const sockaddr, addrlen: socklen_t, ) -> ::ssize_t671 pub fn sendto( 672 socket: ::c_int, 673 buf: *const ::c_void, 674 len: ::size_t, 675 flags: ::c_int, 676 addr: *const sockaddr, 677 addrlen: socklen_t, 678 ) -> ::ssize_t; 679 #[cfg_attr(target_os = "espidf", link_name = "lwip_shutdown")] shutdown(socket: ::c_int, how: ::c_int) -> ::c_int680 pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; 681 682 #[cfg_attr( 683 all(target_os = "macos", target_arch = "x86"), 684 link_name = "chmod$UNIX2003" 685 )] chmod(path: *const c_char, mode: mode_t) -> ::c_int686 pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int; 687 #[cfg_attr( 688 all(target_os = "macos", target_arch = "x86"), 689 link_name = "fchmod$UNIX2003" 690 )] fchmod(fd: ::c_int, mode: mode_t) -> ::c_int691 pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int; 692 693 #[cfg_attr( 694 all(target_os = "macos", not(target_arch = "aarch64")), 695 link_name = "fstat$INODE64" 696 )] 697 #[cfg_attr(target_os = "netbsd", link_name = "__fstat50")] 698 #[cfg_attr( 699 all(target_os = "freebsd", any(freebsd11, freebsd10)), 700 link_name = "fstat@FBSD_1.0" 701 )] 702 #[cfg_attr(target_os = "dragonfly", allow(deprecated))] fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int703 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; 704 mkdir(path: *const c_char, mode: mode_t) -> ::c_int705 pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; 706 707 #[cfg_attr( 708 all(target_os = "macos", not(target_arch = "aarch64")), 709 link_name = "stat$INODE64" 710 )] 711 #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] 712 #[cfg_attr( 713 all(target_os = "freebsd", any(freebsd11, freebsd10)), 714 link_name = "stat@FBSD_1.0" 715 )] 716 #[cfg_attr(target_os = "dragonfly", allow(deprecated))] stat(path: *const c_char, buf: *mut stat) -> ::c_int717 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; 718 pclose(stream: *mut ::FILE) -> ::c_int719 pub fn pclose(stream: *mut ::FILE) -> ::c_int; 720 #[cfg_attr( 721 all(target_os = "macos", target_arch = "x86"), 722 link_name = "fdopen$UNIX2003" 723 )] fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE724 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; fileno(stream: *mut ::FILE) -> ::c_int725 pub fn fileno(stream: *mut ::FILE) -> ::c_int; 726 727 #[cfg_attr( 728 all(target_os = "macos", target_arch = "x86"), 729 link_name = "open$UNIX2003" 730 )] open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int731 pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; 732 #[cfg_attr( 733 all(target_os = "macos", target_arch = "x86"), 734 link_name = "creat$UNIX2003" 735 )] creat(path: *const c_char, mode: mode_t) -> ::c_int736 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; 737 #[cfg_attr( 738 all(target_os = "macos", target_arch = "x86"), 739 link_name = "fcntl$UNIX2003" 740 )] fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int741 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; 742 743 #[cfg_attr( 744 all(target_os = "macos", target_arch = "x86_64"), 745 link_name = "opendir$INODE64" 746 )] 747 #[cfg_attr( 748 all(target_os = "macos", target_arch = "x86"), 749 link_name = "opendir$INODE64$UNIX2003" 750 )] 751 #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] opendir(dirname: *const c_char) -> *mut ::DIR752 pub fn opendir(dirname: *const c_char) -> *mut ::DIR; 753 754 #[cfg_attr( 755 all(target_os = "macos", not(target_arch = "aarch64")), 756 link_name = "readdir$INODE64" 757 )] 758 #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")] 759 #[cfg_attr( 760 all(target_os = "freebsd", any(freebsd11, freebsd10)), 761 link_name = "readdir@FBSD_1.0" 762 )] readdir(dirp: *mut ::DIR) -> *mut ::dirent763 pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; 764 #[cfg_attr( 765 all(target_os = "macos", target_arch = "x86"), 766 link_name = "closedir$UNIX2003" 767 )] closedir(dirp: *mut ::DIR) -> ::c_int768 pub fn closedir(dirp: *mut ::DIR) -> ::c_int; 769 #[cfg_attr( 770 all(target_os = "macos", target_arch = "x86_64"), 771 link_name = "rewinddir$INODE64" 772 )] 773 #[cfg_attr( 774 all(target_os = "macos", target_arch = "x86"), 775 link_name = "rewinddir$INODE64$UNIX2003" 776 )] rewinddir(dirp: *mut ::DIR)777 pub fn rewinddir(dirp: *mut ::DIR); 778 fchmodat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, flags: ::c_int, ) -> ::c_int779 pub fn fchmodat( 780 dirfd: ::c_int, 781 pathname: *const ::c_char, 782 mode: ::mode_t, 783 flags: ::c_int, 784 ) -> ::c_int; fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int785 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_int786 pub fn fchownat( 787 dirfd: ::c_int, 788 pathname: *const ::c_char, 789 owner: ::uid_t, 790 group: ::gid_t, 791 flags: ::c_int, 792 ) -> ::c_int; 793 #[cfg_attr( 794 all(target_os = "macos", not(target_arch = "aarch64")), 795 link_name = "fstatat$INODE64" 796 )] 797 #[cfg_attr( 798 all(target_os = "freebsd", any(freebsd11, freebsd10)), 799 link_name = "fstatat@FBSD_1.1" 800 )] 801 #[cfg_attr(target_os = "dragonfly", allow(deprecated))] fstatat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int, ) -> ::c_int802 pub fn fstatat( 803 dirfd: ::c_int, 804 pathname: *const ::c_char, 805 buf: *mut stat, 806 flags: ::c_int, 807 ) -> ::c_int; linkat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int, ) -> ::c_int808 pub fn linkat( 809 olddirfd: ::c_int, 810 oldpath: *const ::c_char, 811 newdirfd: ::c_int, 812 newpath: *const ::c_char, 813 flags: ::c_int, 814 ) -> ::c_int; renameat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, ) -> ::c_int815 pub fn renameat( 816 olddirfd: ::c_int, 817 oldpath: *const ::c_char, 818 newdirfd: ::c_int, 819 newpath: *const ::c_char, 820 ) -> ::c_int; symlinkat( target: *const ::c_char, newdirfd: ::c_int, linkpath: *const ::c_char, ) -> ::c_int821 pub fn symlinkat( 822 target: *const ::c_char, 823 newdirfd: ::c_int, 824 linkpath: *const ::c_char, 825 ) -> ::c_int; unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int826 pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int; 827 access(path: *const c_char, amode: ::c_int) -> ::c_int828 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; alarm(seconds: ::c_uint) -> ::c_uint829 pub fn alarm(seconds: ::c_uint) -> ::c_uint; chdir(dir: *const c_char) -> ::c_int830 pub fn chdir(dir: *const c_char) -> ::c_int; fchdir(dirfd: ::c_int) -> ::c_int831 pub fn fchdir(dirfd: ::c_int) -> ::c_int; chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int832 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 833 #[cfg_attr( 834 all(target_os = "macos", target_arch = "x86"), 835 link_name = "lchown$UNIX2003" 836 )] lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int837 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 838 #[cfg_attr( 839 all(target_os = "macos", target_arch = "x86"), 840 link_name = "close$NOCANCEL$UNIX2003" 841 )] 842 #[cfg_attr( 843 all(target_os = "macos", target_arch = "x86_64"), 844 link_name = "close$NOCANCEL" 845 )] close(fd: ::c_int) -> ::c_int846 pub fn close(fd: ::c_int) -> ::c_int; dup(fd: ::c_int) -> ::c_int847 pub fn dup(fd: ::c_int) -> ::c_int; dup2(src: ::c_int, dst: ::c_int) -> ::c_int848 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int849 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int850 pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int851 pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int852 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_int853 pub fn execve( 854 prog: *const c_char, 855 argv: *const *const c_char, 856 envp: *const *const c_char, 857 ) -> ::c_int; execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int858 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; fork() -> pid_t859 pub fn fork() -> pid_t; fpathconf(filedes: ::c_int, name: ::c_int) -> c_long860 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char861 pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; getegid() -> gid_t862 pub fn getegid() -> gid_t; geteuid() -> uid_t863 pub fn geteuid() -> uid_t; getgid() -> gid_t864 pub fn getgid() -> gid_t; getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int865 pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int; 866 #[cfg_attr(target_os = "illumos", link_name = "getloginx")] getlogin() -> *mut c_char867 pub fn getlogin() -> *mut c_char; 868 #[cfg_attr( 869 all(target_os = "macos", target_arch = "x86"), 870 link_name = "getopt$UNIX2003" 871 )] getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int872 pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int; getpgid(pid: pid_t) -> pid_t873 pub fn getpgid(pid: pid_t) -> pid_t; getpgrp() -> pid_t874 pub fn getpgrp() -> pid_t; getpid() -> pid_t875 pub fn getpid() -> pid_t; getppid() -> pid_t876 pub fn getppid() -> pid_t; getuid() -> uid_t877 pub fn getuid() -> uid_t; isatty(fd: ::c_int) -> ::c_int878 pub fn isatty(fd: ::c_int) -> ::c_int; link(src: *const c_char, dst: *const c_char) -> ::c_int879 pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t880 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; pathconf(path: *const c_char, name: ::c_int) -> c_long881 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; pipe(fds: *mut ::c_int) -> ::c_int882 pub fn pipe(fds: *mut ::c_int) -> ::c_int; posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int883 pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int; 884 #[cfg_attr( 885 all(target_os = "macos", target_arch = "x86"), 886 link_name = "read$UNIX2003" 887 )] read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t888 pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t; rmdir(path: *const c_char) -> ::c_int889 pub fn rmdir(path: *const c_char) -> ::c_int; seteuid(uid: uid_t) -> ::c_int890 pub fn seteuid(uid: uid_t) -> ::c_int; setegid(gid: gid_t) -> ::c_int891 pub fn setegid(gid: gid_t) -> ::c_int; setgid(gid: gid_t) -> ::c_int892 pub fn setgid(gid: gid_t) -> ::c_int; setpgid(pid: pid_t, pgid: pid_t) -> ::c_int893 pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; setsid() -> pid_t894 pub fn setsid() -> pid_t; setuid(uid: uid_t) -> ::c_int895 pub fn setuid(uid: uid_t) -> ::c_int; 896 #[cfg_attr( 897 all(target_os = "macos", target_arch = "x86"), 898 link_name = "sleep$UNIX2003" 899 )] sleep(secs: ::c_uint) -> ::c_uint900 pub fn sleep(secs: ::c_uint) -> ::c_uint; 901 #[cfg_attr( 902 all(target_os = "macos", target_arch = "x86"), 903 link_name = "nanosleep$UNIX2003" 904 )] 905 #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")] nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int906 pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int; tcgetpgrp(fd: ::c_int) -> pid_t907 pub fn tcgetpgrp(fd: ::c_int) -> pid_t; tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int908 pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; ttyname(fd: ::c_int) -> *mut c_char909 pub fn ttyname(fd: ::c_int) -> *mut c_char; 910 #[cfg_attr( 911 all(target_os = "macos", target_arch = "x86"), 912 link_name = "ttyname_r$UNIX2003" 913 )] 914 #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")] ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int915 pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; unlink(c: *const c_char) -> ::c_int916 pub fn unlink(c: *const c_char) -> ::c_int; 917 #[cfg_attr( 918 all(target_os = "macos", target_arch = "x86"), 919 link_name = "wait$UNIX2003" 920 )] wait(status: *mut ::c_int) -> pid_t921 pub fn wait(status: *mut ::c_int) -> pid_t; 922 #[cfg_attr( 923 all(target_os = "macos", target_arch = "x86"), 924 link_name = "waitpid$UNIX2003" 925 )] waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t926 pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t; 927 #[cfg_attr( 928 all(target_os = "macos", target_arch = "x86"), 929 link_name = "write$UNIX2003" 930 )] write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t931 pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t; 932 #[cfg_attr( 933 all(target_os = "macos", target_arch = "x86"), 934 link_name = "pread$UNIX2003" 935 )] pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t936 pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; 937 #[cfg_attr( 938 all(target_os = "macos", target_arch = "x86"), 939 link_name = "pwrite$UNIX2003" 940 )] pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t941 pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; umask(mask: mode_t) -> mode_t942 pub fn umask(mask: mode_t) -> mode_t; 943 944 #[cfg_attr(target_os = "netbsd", link_name = "__utime50")] utime(file: *const c_char, buf: *const utimbuf) -> ::c_int945 pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; 946 947 #[cfg_attr( 948 all(target_os = "macos", target_arch = "x86"), 949 link_name = "kill$UNIX2003" 950 )] kill(pid: pid_t, sig: ::c_int) -> ::c_int951 pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; 952 #[cfg_attr( 953 all(target_os = "macos", target_arch = "x86"), 954 link_name = "killpg$UNIX2003" 955 )] killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int956 pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int; 957 mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int958 pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int959 pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; mlockall(flags: ::c_int) -> ::c_int960 pub fn mlockall(flags: ::c_int) -> ::c_int; munlockall() -> ::c_int961 pub fn munlockall() -> ::c_int; 962 963 #[cfg_attr( 964 all(target_os = "macos", target_arch = "x86"), 965 link_name = "mmap$UNIX2003" 966 )] mmap( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t, ) -> *mut ::c_void967 pub fn mmap( 968 addr: *mut ::c_void, 969 len: ::size_t, 970 prot: ::c_int, 971 flags: ::c_int, 972 fd: ::c_int, 973 offset: off_t, 974 ) -> *mut ::c_void; 975 #[cfg_attr( 976 all(target_os = "macos", target_arch = "x86"), 977 link_name = "munmap$UNIX2003" 978 )] munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int979 pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; 980 if_nametoindex(ifname: *const c_char) -> ::c_uint981 pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char982 pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char; 983 984 #[cfg_attr( 985 all(target_os = "macos", not(target_arch = "aarch64")), 986 link_name = "lstat$INODE64" 987 )] 988 #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] 989 #[cfg_attr( 990 all(target_os = "freebsd", any(freebsd11, freebsd10)), 991 link_name = "lstat@FBSD_1.0" 992 )] 993 #[cfg_attr(target_os = "dragonfly", allow(deprecated))] lstat(path: *const c_char, buf: *mut stat) -> ::c_int994 pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; 995 996 #[cfg_attr( 997 all(target_os = "macos", target_arch = "x86"), 998 link_name = "fsync$UNIX2003" 999 )] fsync(fd: ::c_int) -> ::c_int1000 pub fn fsync(fd: ::c_int) -> ::c_int; 1001 1002 #[cfg_attr( 1003 all(target_os = "macos", target_arch = "x86"), 1004 link_name = "setenv$UNIX2003" 1005 )] setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int1006 pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int; 1007 #[cfg_attr( 1008 all(target_os = "macos", target_arch = "x86"), 1009 link_name = "unsetenv$UNIX2003" 1010 )] 1011 #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")] unsetenv(name: *const c_char) -> ::c_int1012 pub fn unsetenv(name: *const c_char) -> ::c_int; 1013 symlink(path1: *const c_char, path2: *const c_char) -> ::c_int1014 pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int; 1015 ftruncate(fd: ::c_int, length: off_t) -> ::c_int1016 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; 1017 signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t1018 pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; 1019 1020 #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int1021 pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; 1022 1023 #[cfg_attr( 1024 any(target_os = "macos", target_os = "ios"), 1025 link_name = "realpath$DARWIN_EXTSN" 1026 )] realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char1027 pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char; 1028 flock(fd: ::c_int, operation: ::c_int) -> ::c_int1029 pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; 1030 1031 #[cfg_attr(target_os = "netbsd", link_name = "__times13")] times(buf: *mut ::tms) -> ::clock_t1032 pub fn times(buf: *mut ::tms) -> ::clock_t; 1033 pthread_self() -> ::pthread_t1034 pub fn pthread_self() -> ::pthread_t; 1035 #[cfg_attr( 1036 all(target_os = "macos", target_arch = "x86"), 1037 link_name = "pthread_join$UNIX2003" 1038 )] pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int1039 pub fn pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int; pthread_exit(value: *mut ::c_void) -> !1040 pub fn pthread_exit(value: *mut ::c_void) -> !; pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int1041 pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int1042 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_int1043 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_int1044 pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int; pthread_detach(thread: ::pthread_t) -> ::c_int1045 pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; 1046 #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")] sched_yield() -> ::c_int1047 pub fn sched_yield() -> ::c_int; pthread_key_create( key: *mut pthread_key_t, dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, ) -> ::c_int1048 pub fn pthread_key_create( 1049 key: *mut pthread_key_t, 1050 dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, 1051 ) -> ::c_int; pthread_key_delete(key: pthread_key_t) -> ::c_int1052 pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; pthread_getspecific(key: pthread_key_t) -> *mut ::c_void1053 pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int1054 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_int1055 pub fn pthread_mutex_init( 1056 lock: *mut pthread_mutex_t, 1057 attr: *const pthread_mutexattr_t, 1058 ) -> ::c_int; pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int1059 pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int1060 pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int1061 pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int1062 pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; 1063 pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int1064 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; 1065 #[cfg_attr( 1066 all(target_os = "macos", target_arch = "x86"), 1067 link_name = "pthread_mutexattr_destroy$UNIX2003" 1068 )] pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int1069 pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int; pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int1070 pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int; 1071 1072 #[cfg_attr( 1073 all(target_os = "macos", target_arch = "x86"), 1074 link_name = "pthread_cond_init$UNIX2003" 1075 )] pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> ::c_int1076 pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) 1077 -> ::c_int; 1078 #[cfg_attr( 1079 all(target_os = "macos", target_arch = "x86"), 1080 link_name = "pthread_cond_wait$UNIX2003" 1081 )] pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int1082 pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int; 1083 #[cfg_attr( 1084 all(target_os = "macos", target_arch = "x86"), 1085 link_name = "pthread_cond_timedwait$UNIX2003" 1086 )] pthread_cond_timedwait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1087 pub fn pthread_cond_timedwait( 1088 cond: *mut pthread_cond_t, 1089 lock: *mut pthread_mutex_t, 1090 abstime: *const ::timespec, 1091 ) -> ::c_int; pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int1092 pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int1093 pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int1094 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int1095 pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int; pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int1096 pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int; 1097 #[cfg_attr( 1098 all(target_os = "macos", target_arch = "x86"), 1099 link_name = "pthread_rwlock_init$UNIX2003" 1100 )] pthread_rwlock_init( lock: *mut pthread_rwlock_t, attr: *const pthread_rwlockattr_t, ) -> ::c_int1101 pub fn pthread_rwlock_init( 1102 lock: *mut pthread_rwlock_t, 1103 attr: *const pthread_rwlockattr_t, 1104 ) -> ::c_int; 1105 #[cfg_attr( 1106 all(target_os = "macos", target_arch = "x86"), 1107 link_name = "pthread_rwlock_destroy$UNIX2003" 1108 )] pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int1109 pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; 1110 #[cfg_attr( 1111 all(target_os = "macos", target_arch = "x86"), 1112 link_name = "pthread_rwlock_rdlock$UNIX2003" 1113 )] pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int1114 pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1115 #[cfg_attr( 1116 all(target_os = "macos", target_arch = "x86"), 1117 link_name = "pthread_rwlock_tryrdlock$UNIX2003" 1118 )] pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int1119 pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1120 #[cfg_attr( 1121 all(target_os = "macos", target_arch = "x86"), 1122 link_name = "pthread_rwlock_wrlock$UNIX2003" 1123 )] pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int1124 pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1125 #[cfg_attr( 1126 all(target_os = "macos", target_arch = "x86"), 1127 link_name = "pthread_rwlock_trywrlock$UNIX2003" 1128 )] pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int1129 pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1130 #[cfg_attr( 1131 all(target_os = "macos", target_arch = "x86"), 1132 link_name = "pthread_rwlock_unlock$UNIX2003" 1133 )] pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int1134 pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int1135 pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int; pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int1136 pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int; 1137 1138 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")] 1139 #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")] getsockopt( sockfd: ::c_int, level: ::c_int, optname: ::c_int, optval: *mut ::c_void, optlen: *mut ::socklen_t, ) -> ::c_int1140 pub fn getsockopt( 1141 sockfd: ::c_int, 1142 level: ::c_int, 1143 optname: ::c_int, 1144 optval: *mut ::c_void, 1145 optlen: *mut ::socklen_t, 1146 ) -> ::c_int; raise(signum: ::c_int) -> ::c_int1147 pub fn raise(signum: ::c_int) -> ::c_int; 1148 #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")] sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int1149 pub fn sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int; 1150 1151 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int1152 pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int; dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void1153 pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; dlerror() -> *mut ::c_char1154 pub fn dlerror() -> *mut ::c_char; dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void1155 pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void; dlclose(handle: *mut ::c_void) -> ::c_int1156 pub fn dlclose(handle: *mut ::c_void) -> ::c_int; dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int1157 pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; 1158 1159 #[cfg(not(all( 1160 libc_cfg_target_vendor, 1161 target_arch = "powerpc", 1162 target_vendor = "nintendo" 1163 )))] 1164 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")] 1165 #[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")] getaddrinfo( node: *const c_char, service: *const c_char, hints: *const addrinfo, res: *mut *mut addrinfo, ) -> ::c_int1166 pub fn getaddrinfo( 1167 node: *const c_char, 1168 service: *const c_char, 1169 hints: *const addrinfo, 1170 res: *mut *mut addrinfo, 1171 ) -> ::c_int; 1172 #[cfg(not(all( 1173 libc_cfg_target_vendor, 1174 target_arch = "powerpc", 1175 target_vendor = "nintendo" 1176 )))] 1177 #[cfg_attr(target_os = "espidf", link_name = "lwip_freeaddrinfo")] freeaddrinfo(res: *mut addrinfo)1178 pub fn freeaddrinfo(res: *mut addrinfo); hstrerror(errcode: ::c_int) -> *const ::c_char1179 pub fn hstrerror(errcode: ::c_int) -> *const ::c_char; gai_strerror(errcode: ::c_int) -> *const ::c_char1180 pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; 1181 #[cfg_attr( 1182 any( 1183 all(target_os = "linux", not(target_env = "musl")), 1184 target_os = "freebsd", 1185 target_os = "dragonfly", 1186 target_os = "haiku" 1187 ), 1188 link_name = "__res_init" 1189 )] 1190 #[cfg_attr(any(target_os = "macos", target_os = "ios"), link_name = "res_9_init")] res_init() -> ::c_int1191 pub fn res_init() -> ::c_int; 1192 1193 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] 1194 #[cfg_attr(target_env = "musl", allow(deprecated))] 1195 // FIXME: for `time_t` gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1196 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 1197 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] 1198 #[cfg_attr(target_env = "musl", allow(deprecated))] 1199 // FIXME: for `time_t` localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1200 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 1201 #[cfg_attr( 1202 all(target_os = "macos", target_arch = "x86"), 1203 link_name = "mktime$UNIX2003" 1204 )] 1205 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] 1206 #[cfg_attr(target_env = "musl", allow(deprecated))] 1207 // FIXME: for `time_t` mktime(tm: *mut tm) -> time_t1208 pub fn mktime(tm: *mut tm) -> time_t; 1209 #[cfg_attr(target_os = "netbsd", link_name = "__time50")] 1210 #[cfg_attr(target_env = "musl", allow(deprecated))] 1211 // FIXME: for `time_t` time(time: *mut time_t) -> time_t1212 pub fn time(time: *mut time_t) -> time_t; 1213 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")] 1214 #[cfg_attr(target_env = "musl", allow(deprecated))] 1215 // FIXME: for `time_t` gmtime(time_p: *const time_t) -> *mut tm1216 pub fn gmtime(time_p: *const time_t) -> *mut tm; 1217 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")] 1218 #[cfg_attr(target_env = "musl", allow(deprecated))] 1219 // FIXME: for `time_t` localtime(time_p: *const time_t) -> *mut tm1220 pub fn localtime(time_p: *const time_t) -> *mut tm; 1221 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")] 1222 #[cfg_attr(target_env = "musl", allow(deprecated))] 1223 // FIXME: for `time_t` difftime(time1: time_t, time0: time_t) -> ::c_double1224 pub fn difftime(time1: time_t, time0: time_t) -> ::c_double; 1225 #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] 1226 #[cfg_attr(target_env = "musl", allow(deprecated))] 1227 // FIXME: for `time_t` timegm(tm: *mut ::tm) -> time_t1228 pub fn timegm(tm: *mut ::tm) -> time_t; 1229 1230 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] 1231 #[cfg_attr( 1232 all(target_os = "freebsd", any(freebsd11, freebsd10)), 1233 link_name = "mknod@FBSD_1.0" 1234 )] mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int1235 pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int; gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1236 pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; endservent()1237 pub fn endservent(); getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent1238 pub fn getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent; getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent1239 pub fn getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent; getservent() -> *mut servent1240 pub fn getservent() -> *mut servent; setservent(stayopen: ::c_int)1241 pub fn setservent(stayopen: ::c_int); getprotobyname(name: *const ::c_char) -> *mut protoent1242 pub fn getprotobyname(name: *const ::c_char) -> *mut protoent; getprotobynumber(proto: ::c_int) -> *mut protoent1243 pub fn getprotobynumber(proto: ::c_int) -> *mut protoent; chroot(name: *const ::c_char) -> ::c_int1244 pub fn chroot(name: *const ::c_char) -> ::c_int; 1245 #[cfg_attr( 1246 all(target_os = "macos", target_arch = "x86"), 1247 link_name = "usleep$UNIX2003" 1248 )] usleep(secs: ::c_uint) -> ::c_int1249 pub fn usleep(secs: ::c_uint) -> ::c_int; 1250 #[cfg_attr( 1251 all(target_os = "macos", target_arch = "x86"), 1252 link_name = "send$UNIX2003" 1253 )] 1254 #[cfg_attr(target_os = "espidf", link_name = "lwip_send")] send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1255 pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 1256 #[cfg_attr( 1257 all(target_os = "macos", target_arch = "x86"), 1258 link_name = "recv$UNIX2003" 1259 )] 1260 #[cfg_attr(target_os = "espidf", link_name = "lwip_recv")] recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1261 pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 1262 #[cfg_attr( 1263 all(target_os = "macos", target_arch = "x86"), 1264 link_name = "putenv$UNIX2003" 1265 )] 1266 #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")] putenv(string: *mut c_char) -> ::c_int1267 pub fn putenv(string: *mut c_char) -> ::c_int; 1268 #[cfg_attr( 1269 all(target_os = "macos", target_arch = "x86"), 1270 link_name = "poll$UNIX2003" 1271 )] poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1272 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; 1273 #[cfg_attr( 1274 all(target_os = "macos", target_arch = "x86_64"), 1275 link_name = "select$1050" 1276 )] 1277 #[cfg_attr( 1278 all(target_os = "macos", target_arch = "x86"), 1279 link_name = "select$UNIX2003" 1280 )] 1281 #[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_int1282 pub fn select( 1283 nfds: ::c_int, 1284 readfs: *mut fd_set, 1285 writefds: *mut fd_set, 1286 errorfds: *mut fd_set, 1287 timeout: *mut timeval, 1288 ) -> ::c_int; 1289 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")] setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char1290 pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char; localeconv() -> *mut lconv1291 pub fn localeconv() -> *mut lconv; 1292 1293 #[cfg_attr( 1294 all(target_os = "macos", target_arch = "x86"), 1295 link_name = "sem_wait$UNIX2003" 1296 )] sem_wait(sem: *mut sem_t) -> ::c_int1297 pub fn sem_wait(sem: *mut sem_t) -> ::c_int; sem_trywait(sem: *mut sem_t) -> ::c_int1298 pub fn sem_trywait(sem: *mut sem_t) -> ::c_int; sem_post(sem: *mut sem_t) -> ::c_int1299 pub fn sem_post(sem: *mut sem_t) -> ::c_int; statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int1300 pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int1301 pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; 1302 readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t1303 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t; 1304 1305 #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")] sigemptyset(set: *mut sigset_t) -> ::c_int1306 pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; 1307 #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")] sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1308 pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 1309 #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")] sigfillset(set: *mut sigset_t) -> ::c_int1310 pub fn sigfillset(set: *mut sigset_t) -> ::c_int; 1311 #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")] sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1312 pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 1313 #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")] sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int1314 pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; 1315 1316 #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")] sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1317 pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int; 1318 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")] sigpending(set: *mut sigset_t) -> ::c_int1319 pub fn sigpending(set: *mut sigset_t) -> ::c_int; 1320 sysconf(name: ::c_int) -> ::c_long1321 pub fn sysconf(name: ::c_int) -> ::c_long; 1322 mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1323 pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; 1324 1325 #[cfg_attr( 1326 all(target_os = "macos", target_arch = "x86_64"), 1327 link_name = "pselect$1050" 1328 )] 1329 #[cfg_attr( 1330 all(target_os = "macos", target_arch = "x86"), 1331 link_name = "pselect$UNIX2003" 1332 )] 1333 #[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_int1334 pub fn pselect( 1335 nfds: ::c_int, 1336 readfs: *mut fd_set, 1337 writefds: *mut fd_set, 1338 errorfds: *mut fd_set, 1339 timeout: *const timespec, 1340 sigmask: *const sigset_t, 1341 ) -> ::c_int; fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int1342 pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int; ftello(stream: *mut ::FILE) -> ::off_t1343 pub fn ftello(stream: *mut ::FILE) -> ::off_t; 1344 #[cfg_attr( 1345 all(target_os = "macos", target_arch = "x86"), 1346 link_name = "tcdrain$UNIX2003" 1347 )] tcdrain(fd: ::c_int) -> ::c_int1348 pub fn tcdrain(fd: ::c_int) -> ::c_int; cfgetispeed(termios: *const ::termios) -> ::speed_t1349 pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; cfgetospeed(termios: *const ::termios) -> ::speed_t1350 pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1351 pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1352 pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int1353 pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int1354 pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int; tcflow(fd: ::c_int, action: ::c_int) -> ::c_int1355 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; tcflush(fd: ::c_int, action: ::c_int) -> ::c_int1356 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; tcgetsid(fd: ::c_int) -> ::pid_t1357 pub fn tcgetsid(fd: ::c_int) -> ::pid_t; tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int1358 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; mkstemp(template: *mut ::c_char) -> ::c_int1359 pub fn mkstemp(template: *mut ::c_char) -> ::c_int; mkdtemp(template: *mut ::c_char) -> *mut ::c_char1360 pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; 1361 tmpnam(ptr: *mut ::c_char) -> *mut ::c_char1362 pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char; 1363 openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int)1364 pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); closelog()1365 pub fn closelog(); setlogmask(maskpri: ::c_int) -> ::c_int1366 pub fn setlogmask(maskpri: ::c_int) -> ::c_int; 1367 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")] syslog(priority: ::c_int, message: *const ::c_char, ...)1368 pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); 1369 #[cfg_attr( 1370 all(target_os = "macos", target_arch = "x86"), 1371 link_name = "nice$UNIX2003" 1372 )] nice(incr: ::c_int) -> ::c_int1373 pub fn nice(incr: ::c_int) -> ::c_int; 1374 grantpt(fd: ::c_int) -> ::c_int1375 pub fn grantpt(fd: ::c_int) -> ::c_int; posix_openpt(flags: ::c_int) -> ::c_int1376 pub fn posix_openpt(flags: ::c_int) -> ::c_int; ptsname(fd: ::c_int) -> *mut ::c_char1377 pub fn ptsname(fd: ::c_int) -> *mut ::c_char; unlockpt(fd: ::c_int) -> ::c_int1378 pub fn unlockpt(fd: ::c_int) -> ::c_int; 1379 strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char1380 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_t1381 pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t; 1382 lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int1383 pub fn lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int; 1384 } 1385 1386 cfg_if! { 1387 if #[cfg(not(target_env = "uclibc"))] { 1388 extern "C" { 1389 pub fn open_wmemstream( 1390 ptr: *mut *mut wchar_t, 1391 sizeloc: *mut size_t, 1392 ) -> *mut FILE; 1393 } 1394 } 1395 } 1396 1397 cfg_if! { 1398 if #[cfg(not(target_os = "redox"))] { 1399 extern { 1400 pub fn getsid(pid: pid_t) -> pid_t; 1401 pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; 1402 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 1403 link_name = "pause$UNIX2003")] 1404 pub fn pause() -> ::c_int; 1405 1406 pub fn readlinkat(dirfd: ::c_int, 1407 pathname: *const ::c_char, 1408 buf: *mut ::c_char, 1409 bufsiz: ::size_t) -> ::ssize_t; 1410 pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, 1411 mode: ::mode_t) -> ::c_int; 1412 pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, 1413 flags: ::c_int, ...) -> ::c_int; 1414 1415 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), 1416 link_name = "fdopendir$INODE64")] 1417 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 1418 link_name = "fdopendir$INODE64$UNIX2003")] 1419 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; 1420 1421 #[cfg_attr(all(target_os = "macos", not(target_arch = "aarch64")), 1422 link_name = "readdir_r$INODE64")] 1423 #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] 1424 #[cfg_attr( 1425 all(target_os = "freebsd", any(freebsd11, freebsd10)), 1426 link_name = "readdir_r@FBSD_1.0" 1427 )] 1428 #[allow(non_autolinks)] // FIXME: `<>` breaks line length limit. 1429 /// The 64-bit libc on Solaris and illumos only has readdir_r. If a 1430 /// 32-bit Solaris or illumos target is ever created, it should use 1431 /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: 1432 /// https://illumos.org/man/3lib/libc 1433 /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html 1434 /// https://www.unix.com/man-page/opensolaris/3LIB/libc/ 1435 pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, 1436 result: *mut *mut ::dirent) -> ::c_int; 1437 } 1438 } 1439 } 1440 1441 cfg_if! { 1442 if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] { 1443 extern { 1444 pub fn cfmakeraw(termios: *mut ::termios); 1445 pub fn cfsetspeed(termios: *mut ::termios, 1446 speed: ::speed_t) -> ::c_int; 1447 } 1448 } 1449 } 1450 1451 cfg_if! { 1452 if #[cfg(target_env = "newlib")] { 1453 mod newlib; 1454 pub use self::newlib::*; 1455 } else if #[cfg(any(target_os = "linux", 1456 target_os = "l4re", 1457 target_os = "android", 1458 target_os = "emscripten"))] { 1459 mod linux_like; 1460 pub use self::linux_like::*; 1461 } else if #[cfg(any(target_os = "macos", 1462 target_os = "ios", 1463 target_os = "freebsd", 1464 target_os = "dragonfly", 1465 target_os = "openbsd", 1466 target_os = "netbsd"))] { 1467 mod bsd; 1468 pub use self::bsd::*; 1469 } else if #[cfg(any(target_os = "solaris", 1470 target_os = "illumos"))] { 1471 mod solarish; 1472 pub use self::solarish::*; 1473 } else if #[cfg(target_os = "haiku")] { 1474 mod haiku; 1475 pub use self::haiku::*; 1476 } else if #[cfg(target_os = "hermit")] { 1477 mod hermit; 1478 pub use self::hermit::*; 1479 } else if #[cfg(target_os = "redox")] { 1480 mod redox; 1481 pub use self::redox::*; 1482 } else { 1483 // Unknown target_os 1484 } 1485 } 1486 1487 cfg_if! { 1488 if #[cfg(libc_core_cvoid)] { 1489 pub use ::ffi::c_void; 1490 } else { 1491 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help 1492 // enable more optimization opportunities around it recognizing things 1493 // like malloc/free. 1494 #[repr(u8)] 1495 #[allow(missing_copy_implementations)] 1496 #[allow(missing_debug_implementations)] 1497 pub enum c_void { 1498 // Two dummy variants so the #[repr] attribute can be used. 1499 #[doc(hidden)] 1500 __variant1, 1501 #[doc(hidden)] 1502 __variant2, 1503 } 1504 } 1505 } 1506 1507 cfg_if! { 1508 if #[cfg(libc_align)] { 1509 mod align; 1510 pub use self::align::*; 1511 } else { 1512 mod no_align; 1513 pub use self::no_align::*; 1514 } 1515 } 1516