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-nobundle", 309 cfg(target_feature = "crt-static"))] 310 #[link(name = "rt", kind = "static-nobundle", 311 cfg(target_feature = "crt-static"))] 312 #[link(name = "pthread", kind = "static-nobundle", 313 cfg(target_feature = "crt-static"))] 314 #[link(name = "m", kind = "static-nobundle", 315 cfg(target_feature = "crt-static"))] 316 #[link(name = "dl", kind = "static-nobundle", 317 cfg(target_feature = "crt-static"))] 318 #[link(name = "c", kind = "static-nobundle", 319 cfg(target_feature = "crt-static"))] 320 #[link(name = "gcc_eh", kind = "static-nobundle", 321 cfg(target_feature = "crt-static"))] 322 #[link(name = "gcc", kind = "static-nobundle", 323 cfg(target_feature = "crt-static"))] 324 #[link(name = "util", cfg(not(target_feature = "crt-static")))] 325 #[link(name = "rt", cfg(not(target_feature = "crt-static")))] 326 #[link(name = "pthread", cfg(not(target_feature = "crt-static")))] 327 #[link(name = "m", cfg(not(target_feature = "crt-static")))] 328 #[link(name = "dl", cfg(not(target_feature = "crt-static")))] 329 #[link(name = "c", cfg(not(target_feature = "crt-static")))] 330 extern {} 331 } else if #[cfg(target_env = "musl")] { 332 #[cfg_attr(feature = "rustc-dep-of-std", 333 link(name = "c", kind = "static", 334 cfg(target_feature = "crt-static")))] 335 #[cfg_attr(feature = "rustc-dep-of-std", 336 link(name = "c", cfg(not(target_feature = "crt-static"))))] 337 extern {} 338 } else if #[cfg(target_os = "emscripten")] { 339 #[link(name = "c")] 340 extern {} 341 } else if #[cfg(all(target_os = "netbsd", 342 feature = "rustc-dep-of-std", 343 target_vendor = "rumprun"))] { 344 // Since we don't use -nodefaultlibs on Rumprun, libc is always pulled 345 // in automatically by the linker. We avoid passing it explicitly, as it 346 // causes some versions of binutils to crash with an assertion failure. 347 #[link(name = "m")] 348 extern {} 349 } else if #[cfg(any(target_os = "macos", 350 target_os = "ios", 351 target_os = "android", 352 target_os = "openbsd"))] { 353 #[link(name = "c")] 354 #[link(name = "m")] 355 extern {} 356 } else if #[cfg(target_os = "haiku")] { 357 #[link(name = "root")] 358 #[link(name = "network")] 359 extern {} 360 } else if #[cfg(target_env = "newlib")] { 361 #[link(name = "c")] 362 #[link(name = "m")] 363 extern {} 364 } else if #[cfg(target_os = "hermit")] { 365 // no_default_libraries is set to false for HermitCore, so only a link 366 // to "pthread" needs to be added. 367 #[link(name = "pthread")] 368 extern {} 369 } else if #[cfg(target_env = "illumos")] { 370 #[link(name = "c")] 371 #[link(name = "m")] 372 extern {} 373 } else if #[cfg(target_os = "redox")] { 374 #[cfg_attr(feature = "rustc-dep-of-std", 375 link(name = "c", kind = "static-nobundle", 376 cfg(target_feature = "crt-static")))] 377 #[cfg_attr(feature = "rustc-dep-of-std", 378 link(name = "c", cfg(not(target_feature = "crt-static"))))] 379 extern {} 380 } else { 381 #[link(name = "c")] 382 #[link(name = "m")] 383 #[link(name = "rt")] 384 #[link(name = "pthread")] 385 extern {} 386 } 387 } 388 389 #[cfg_attr(feature = "extra_traits", derive(Debug))] 390 pub enum FILE {} 391 impl ::Copy for FILE {} 392 impl ::Clone for FILE { clone(&self) -> FILE393 fn clone(&self) -> FILE { 394 *self 395 } 396 } 397 #[cfg_attr(feature = "extra_traits", derive(Debug))] 398 pub enum fpos_t {} // FIXME: fill this out with a struct 399 impl ::Copy for fpos_t {} 400 impl ::Clone for fpos_t { clone(&self) -> fpos_t401 fn clone(&self) -> fpos_t { 402 *self 403 } 404 } 405 406 extern "C" { isalnum(c: c_int) -> c_int407 pub fn isalnum(c: c_int) -> c_int; isalpha(c: c_int) -> c_int408 pub fn isalpha(c: c_int) -> c_int; iscntrl(c: c_int) -> c_int409 pub fn iscntrl(c: c_int) -> c_int; isdigit(c: c_int) -> c_int410 pub fn isdigit(c: c_int) -> c_int; isgraph(c: c_int) -> c_int411 pub fn isgraph(c: c_int) -> c_int; islower(c: c_int) -> c_int412 pub fn islower(c: c_int) -> c_int; isprint(c: c_int) -> c_int413 pub fn isprint(c: c_int) -> c_int; ispunct(c: c_int) -> c_int414 pub fn ispunct(c: c_int) -> c_int; isspace(c: c_int) -> c_int415 pub fn isspace(c: c_int) -> c_int; isupper(c: c_int) -> c_int416 pub fn isupper(c: c_int) -> c_int; isxdigit(c: c_int) -> c_int417 pub fn isxdigit(c: c_int) -> c_int; isblank(c: c_int) -> c_int418 pub fn isblank(c: c_int) -> c_int; tolower(c: c_int) -> c_int419 pub fn tolower(c: c_int) -> c_int; toupper(c: c_int) -> c_int420 pub fn toupper(c: c_int) -> c_int; qsort( base: *mut c_void, num: size_t, size: size_t, compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, )421 pub fn qsort( 422 base: *mut c_void, 423 num: size_t, 424 size: size_t, 425 compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, 426 ); bsearch( key: *const c_void, base: *const c_void, num: size_t, size: size_t, compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, ) -> *mut c_void427 pub fn bsearch( 428 key: *const c_void, 429 base: *const c_void, 430 num: size_t, 431 size: size_t, 432 compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>, 433 ) -> *mut c_void; 434 #[cfg_attr( 435 all(target_os = "macos", target_arch = "x86"), 436 link_name = "fopen$UNIX2003" 437 )] fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE438 pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; 439 #[cfg_attr( 440 all(target_os = "macos", target_arch = "x86"), 441 link_name = "freopen$UNIX2003" 442 )] freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE443 pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE; fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE444 pub fn fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE; open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE445 pub fn open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE; 446 fflush(file: *mut FILE) -> c_int447 pub fn fflush(file: *mut FILE) -> c_int; fclose(file: *mut FILE) -> c_int448 pub fn fclose(file: *mut FILE) -> c_int; remove(filename: *const c_char) -> c_int449 pub fn remove(filename: *const c_char) -> c_int; rename(oldname: *const c_char, newname: *const c_char) -> c_int450 pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int; tmpfile() -> *mut FILE451 pub fn tmpfile() -> *mut FILE; setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int452 pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int; setbuf(stream: *mut FILE, buf: *mut c_char)453 pub fn setbuf(stream: *mut FILE, buf: *mut c_char); getchar() -> c_int454 pub fn getchar() -> c_int; putchar(c: c_int) -> c_int455 pub fn putchar(c: c_int) -> c_int; fgetc(stream: *mut FILE) -> c_int456 pub fn fgetc(stream: *mut FILE) -> c_int; fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char457 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; fputc(c: c_int, stream: *mut FILE) -> c_int458 pub fn fputc(c: c_int, stream: *mut FILE) -> c_int; 459 #[cfg_attr( 460 all(target_os = "macos", target_arch = "x86"), 461 link_name = "fputs$UNIX2003" 462 )] fputs(s: *const c_char, stream: *mut FILE) -> c_int463 pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int; puts(s: *const c_char) -> c_int464 pub fn puts(s: *const c_char) -> c_int; ungetc(c: c_int, stream: *mut FILE) -> c_int465 pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int; fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t466 pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; 467 #[cfg_attr( 468 all(target_os = "macos", target_arch = "x86"), 469 link_name = "fwrite$UNIX2003" 470 )] fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t471 pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t; fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int472 pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int; ftell(stream: *mut FILE) -> c_long473 pub fn ftell(stream: *mut FILE) -> c_long; rewind(stream: *mut FILE)474 pub fn rewind(stream: *mut FILE); 475 #[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")] fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int476 pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int; 477 #[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")] fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int478 pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int; feof(stream: *mut FILE) -> c_int479 pub fn feof(stream: *mut FILE) -> c_int; ferror(stream: *mut FILE) -> c_int480 pub fn ferror(stream: *mut FILE) -> c_int; clearerr(stream: *mut FILE)481 pub fn clearerr(stream: *mut FILE); perror(s: *const c_char)482 pub fn perror(s: *const c_char); atoi(s: *const c_char) -> c_int483 pub fn atoi(s: *const c_char) -> c_int; 484 #[cfg_attr( 485 all(target_os = "macos", target_arch = "x86"), 486 link_name = "strtod$UNIX2003" 487 )] strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double488 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; 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 )] fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int702 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; 703 mkdir(path: *const c_char, mode: mode_t) -> ::c_int704 pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; 705 706 #[cfg_attr( 707 all(target_os = "macos", not(target_arch = "aarch64")), 708 link_name = "stat$INODE64" 709 )] 710 #[cfg_attr(target_os = "netbsd", link_name = "__stat50")] 711 #[cfg_attr( 712 all(target_os = "freebsd", any(freebsd11, freebsd10)), 713 link_name = "stat@FBSD_1.0" 714 )] stat(path: *const c_char, buf: *mut stat) -> ::c_int715 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; 716 pclose(stream: *mut ::FILE) -> ::c_int717 pub fn pclose(stream: *mut ::FILE) -> ::c_int; 718 #[cfg_attr( 719 all(target_os = "macos", target_arch = "x86"), 720 link_name = "fdopen$UNIX2003" 721 )] fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE722 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; fileno(stream: *mut ::FILE) -> ::c_int723 pub fn fileno(stream: *mut ::FILE) -> ::c_int; 724 725 #[cfg_attr( 726 all(target_os = "macos", target_arch = "x86"), 727 link_name = "open$UNIX2003" 728 )] open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int729 pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; 730 #[cfg_attr( 731 all(target_os = "macos", target_arch = "x86"), 732 link_name = "creat$UNIX2003" 733 )] creat(path: *const c_char, mode: mode_t) -> ::c_int734 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; 735 #[cfg_attr( 736 all(target_os = "macos", target_arch = "x86"), 737 link_name = "fcntl$UNIX2003" 738 )] fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int739 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; 740 741 #[cfg_attr( 742 all(target_os = "macos", target_arch = "x86_64"), 743 link_name = "opendir$INODE64" 744 )] 745 #[cfg_attr( 746 all(target_os = "macos", target_arch = "x86"), 747 link_name = "opendir$INODE64$UNIX2003" 748 )] 749 #[cfg_attr(target_os = "netbsd", link_name = "__opendir30")] opendir(dirname: *const c_char) -> *mut ::DIR750 pub fn opendir(dirname: *const c_char) -> *mut ::DIR; 751 752 #[cfg_attr( 753 all(target_os = "macos", not(target_arch = "aarch64")), 754 link_name = "readdir$INODE64" 755 )] 756 #[cfg_attr(target_os = "netbsd", link_name = "__readdir30")] 757 #[cfg_attr( 758 all(target_os = "freebsd", any(freebsd11, freebsd10)), 759 link_name = "readdir@FBSD_1.0" 760 )] readdir(dirp: *mut ::DIR) -> *mut ::dirent761 pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; 762 #[cfg_attr( 763 all(target_os = "macos", target_arch = "x86"), 764 link_name = "closedir$UNIX2003" 765 )] closedir(dirp: *mut ::DIR) -> ::c_int766 pub fn closedir(dirp: *mut ::DIR) -> ::c_int; 767 #[cfg_attr( 768 all(target_os = "macos", target_arch = "x86_64"), 769 link_name = "rewinddir$INODE64" 770 )] 771 #[cfg_attr( 772 all(target_os = "macos", target_arch = "x86"), 773 link_name = "rewinddir$INODE64$UNIX2003" 774 )] rewinddir(dirp: *mut ::DIR)775 pub fn rewinddir(dirp: *mut ::DIR); 776 fchmodat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, flags: ::c_int, ) -> ::c_int777 pub fn fchmodat( 778 dirfd: ::c_int, 779 pathname: *const ::c_char, 780 mode: ::mode_t, 781 flags: ::c_int, 782 ) -> ::c_int; fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int783 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_int784 pub fn fchownat( 785 dirfd: ::c_int, 786 pathname: *const ::c_char, 787 owner: ::uid_t, 788 group: ::gid_t, 789 flags: ::c_int, 790 ) -> ::c_int; 791 #[cfg_attr( 792 all(target_os = "macos", not(target_arch = "aarch64")), 793 link_name = "fstatat$INODE64" 794 )] 795 #[cfg_attr( 796 all(target_os = "freebsd", any(freebsd11, freebsd10)), 797 link_name = "fstatat@FBSD_1.1" 798 )] fstatat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int, ) -> ::c_int799 pub fn fstatat( 800 dirfd: ::c_int, 801 pathname: *const ::c_char, 802 buf: *mut stat, 803 flags: ::c_int, 804 ) -> ::c_int; linkat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int, ) -> ::c_int805 pub fn linkat( 806 olddirfd: ::c_int, 807 oldpath: *const ::c_char, 808 newdirfd: ::c_int, 809 newpath: *const ::c_char, 810 flags: ::c_int, 811 ) -> ::c_int; renameat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, ) -> ::c_int812 pub fn renameat( 813 olddirfd: ::c_int, 814 oldpath: *const ::c_char, 815 newdirfd: ::c_int, 816 newpath: *const ::c_char, 817 ) -> ::c_int; symlinkat( target: *const ::c_char, newdirfd: ::c_int, linkpath: *const ::c_char, ) -> ::c_int818 pub fn symlinkat( 819 target: *const ::c_char, 820 newdirfd: ::c_int, 821 linkpath: *const ::c_char, 822 ) -> ::c_int; unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int823 pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int; 824 access(path: *const c_char, amode: ::c_int) -> ::c_int825 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; alarm(seconds: ::c_uint) -> ::c_uint826 pub fn alarm(seconds: ::c_uint) -> ::c_uint; chdir(dir: *const c_char) -> ::c_int827 pub fn chdir(dir: *const c_char) -> ::c_int; fchdir(dirfd: ::c_int) -> ::c_int828 pub fn fchdir(dirfd: ::c_int) -> ::c_int; chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int829 pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 830 #[cfg_attr( 831 all(target_os = "macos", target_arch = "x86"), 832 link_name = "lchown$UNIX2003" 833 )] lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int834 pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int; 835 #[cfg_attr( 836 all(target_os = "macos", target_arch = "x86"), 837 link_name = "close$NOCANCEL$UNIX2003" 838 )] 839 #[cfg_attr( 840 all(target_os = "macos", target_arch = "x86_64"), 841 link_name = "close$NOCANCEL" 842 )] close(fd: ::c_int) -> ::c_int843 pub fn close(fd: ::c_int) -> ::c_int; dup(fd: ::c_int) -> ::c_int844 pub fn dup(fd: ::c_int) -> ::c_int; dup2(src: ::c_int, dst: ::c_int) -> ::c_int845 pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int846 pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int847 pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int848 pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int849 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_int850 pub fn execve( 851 prog: *const c_char, 852 argv: *const *const c_char, 853 envp: *const *const c_char, 854 ) -> ::c_int; execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int855 pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; fork() -> pid_t856 pub fn fork() -> pid_t; fpathconf(filedes: ::c_int, name: ::c_int) -> c_long857 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char858 pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; getegid() -> gid_t859 pub fn getegid() -> gid_t; geteuid() -> uid_t860 pub fn geteuid() -> uid_t; getgid() -> gid_t861 pub fn getgid() -> gid_t; getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int862 pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int; 863 #[cfg_attr(target_os = "illumos", link_name = "getloginx")] getlogin() -> *mut c_char864 pub fn getlogin() -> *mut c_char; 865 #[cfg_attr( 866 all(target_os = "macos", target_arch = "x86"), 867 link_name = "getopt$UNIX2003" 868 )] getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int869 pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int; getpgid(pid: pid_t) -> pid_t870 pub fn getpgid(pid: pid_t) -> pid_t; getpgrp() -> pid_t871 pub fn getpgrp() -> pid_t; getpid() -> pid_t872 pub fn getpid() -> pid_t; getppid() -> pid_t873 pub fn getppid() -> pid_t; getuid() -> uid_t874 pub fn getuid() -> uid_t; isatty(fd: ::c_int) -> ::c_int875 pub fn isatty(fd: ::c_int) -> ::c_int; link(src: *const c_char, dst: *const c_char) -> ::c_int876 pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t877 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; pathconf(path: *const c_char, name: ::c_int) -> c_long878 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; pipe(fds: *mut ::c_int) -> ::c_int879 pub fn pipe(fds: *mut ::c_int) -> ::c_int; posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int880 pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int; 881 #[cfg_attr( 882 all(target_os = "macos", target_arch = "x86"), 883 link_name = "read$UNIX2003" 884 )] read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t885 pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t; rmdir(path: *const c_char) -> ::c_int886 pub fn rmdir(path: *const c_char) -> ::c_int; seteuid(uid: uid_t) -> ::c_int887 pub fn seteuid(uid: uid_t) -> ::c_int; setegid(gid: gid_t) -> ::c_int888 pub fn setegid(gid: gid_t) -> ::c_int; setgid(gid: gid_t) -> ::c_int889 pub fn setgid(gid: gid_t) -> ::c_int; setpgid(pid: pid_t, pgid: pid_t) -> ::c_int890 pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int; setsid() -> pid_t891 pub fn setsid() -> pid_t; setuid(uid: uid_t) -> ::c_int892 pub fn setuid(uid: uid_t) -> ::c_int; 893 #[cfg_attr( 894 all(target_os = "macos", target_arch = "x86"), 895 link_name = "sleep$UNIX2003" 896 )] sleep(secs: ::c_uint) -> ::c_uint897 pub fn sleep(secs: ::c_uint) -> ::c_uint; 898 #[cfg_attr( 899 all(target_os = "macos", target_arch = "x86"), 900 link_name = "nanosleep$UNIX2003" 901 )] 902 #[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")] nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int903 pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int; tcgetpgrp(fd: ::c_int) -> pid_t904 pub fn tcgetpgrp(fd: ::c_int) -> pid_t; tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int905 pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int; ttyname(fd: ::c_int) -> *mut c_char906 pub fn ttyname(fd: ::c_int) -> *mut c_char; 907 #[cfg_attr( 908 all(target_os = "macos", target_arch = "x86"), 909 link_name = "ttyname_r$UNIX2003" 910 )] 911 #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")] ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int912 pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; unlink(c: *const c_char) -> ::c_int913 pub fn unlink(c: *const c_char) -> ::c_int; 914 #[cfg_attr( 915 all(target_os = "macos", target_arch = "x86"), 916 link_name = "wait$UNIX2003" 917 )] wait(status: *mut ::c_int) -> pid_t918 pub fn wait(status: *mut ::c_int) -> pid_t; 919 #[cfg_attr( 920 all(target_os = "macos", target_arch = "x86"), 921 link_name = "waitpid$UNIX2003" 922 )] waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t923 pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t; 924 #[cfg_attr( 925 all(target_os = "macos", target_arch = "x86"), 926 link_name = "write$UNIX2003" 927 )] write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t928 pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t; 929 #[cfg_attr( 930 all(target_os = "macos", target_arch = "x86"), 931 link_name = "pread$UNIX2003" 932 )] pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t933 pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; 934 #[cfg_attr( 935 all(target_os = "macos", target_arch = "x86"), 936 link_name = "pwrite$UNIX2003" 937 )] pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t938 pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; umask(mask: mode_t) -> mode_t939 pub fn umask(mask: mode_t) -> mode_t; 940 941 #[cfg_attr(target_os = "netbsd", link_name = "__utime50")] utime(file: *const c_char, buf: *const utimbuf) -> ::c_int942 pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int; 943 944 #[cfg_attr( 945 all(target_os = "macos", target_arch = "x86"), 946 link_name = "kill$UNIX2003" 947 )] kill(pid: pid_t, sig: ::c_int) -> ::c_int948 pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int; 949 #[cfg_attr( 950 all(target_os = "macos", target_arch = "x86"), 951 link_name = "killpg$UNIX2003" 952 )] killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int953 pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int; 954 mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int955 pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int956 pub fn munlock(addr: *const ::c_void, len: ::size_t) -> ::c_int; mlockall(flags: ::c_int) -> ::c_int957 pub fn mlockall(flags: ::c_int) -> ::c_int; munlockall() -> ::c_int958 pub fn munlockall() -> ::c_int; 959 960 #[cfg_attr( 961 all(target_os = "macos", target_arch = "x86"), 962 link_name = "mmap$UNIX2003" 963 )] mmap( addr: *mut ::c_void, len: ::size_t, prot: ::c_int, flags: ::c_int, fd: ::c_int, offset: off_t, ) -> *mut ::c_void964 pub fn mmap( 965 addr: *mut ::c_void, 966 len: ::size_t, 967 prot: ::c_int, 968 flags: ::c_int, 969 fd: ::c_int, 970 offset: off_t, 971 ) -> *mut ::c_void; 972 #[cfg_attr( 973 all(target_os = "macos", target_arch = "x86"), 974 link_name = "munmap$UNIX2003" 975 )] munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int976 pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; 977 if_nametoindex(ifname: *const c_char) -> ::c_uint978 pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint; if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char979 pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char; 980 981 #[cfg_attr( 982 all(target_os = "macos", not(target_arch = "aarch64")), 983 link_name = "lstat$INODE64" 984 )] 985 #[cfg_attr(target_os = "netbsd", link_name = "__lstat50")] 986 #[cfg_attr( 987 all(target_os = "freebsd", any(freebsd11, freebsd10)), 988 link_name = "lstat@FBSD_1.0" 989 )] lstat(path: *const c_char, buf: *mut stat) -> ::c_int990 pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; 991 992 #[cfg_attr( 993 all(target_os = "macos", target_arch = "x86"), 994 link_name = "fsync$UNIX2003" 995 )] fsync(fd: ::c_int) -> ::c_int996 pub fn fsync(fd: ::c_int) -> ::c_int; 997 998 #[cfg_attr( 999 all(target_os = "macos", target_arch = "x86"), 1000 link_name = "setenv$UNIX2003" 1001 )] setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int1002 pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int; 1003 #[cfg_attr( 1004 all(target_os = "macos", target_arch = "x86"), 1005 link_name = "unsetenv$UNIX2003" 1006 )] 1007 #[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")] unsetenv(name: *const c_char) -> ::c_int1008 pub fn unsetenv(name: *const c_char) -> ::c_int; 1009 symlink(path1: *const c_char, path2: *const c_char) -> ::c_int1010 pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int; 1011 ftruncate(fd: ::c_int, length: off_t) -> ::c_int1012 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; 1013 signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t1014 pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t; 1015 1016 #[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")] getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int1017 pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; 1018 1019 #[cfg_attr( 1020 any(target_os = "macos", target_os = "ios"), 1021 link_name = "realpath$DARWIN_EXTSN" 1022 )] realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char1023 pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char; 1024 flock(fd: ::c_int, operation: ::c_int) -> ::c_int1025 pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int; 1026 1027 #[cfg_attr(target_os = "netbsd", link_name = "__times13")] times(buf: *mut ::tms) -> ::clock_t1028 pub fn times(buf: *mut ::tms) -> ::clock_t; 1029 pthread_self() -> ::pthread_t1030 pub fn pthread_self() -> ::pthread_t; 1031 #[cfg_attr( 1032 all(target_os = "macos", target_arch = "x86"), 1033 link_name = "pthread_join$UNIX2003" 1034 )] pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int1035 pub fn pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::c_int; pthread_exit(value: *mut ::c_void) -> !1036 pub fn pthread_exit(value: *mut ::c_void) -> !; pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int1037 pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int; pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int1038 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_int1039 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_int1040 pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int; pthread_detach(thread: ::pthread_t) -> ::c_int1041 pub fn pthread_detach(thread: ::pthread_t) -> ::c_int; 1042 #[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")] sched_yield() -> ::c_int1043 pub fn sched_yield() -> ::c_int; pthread_key_create( key: *mut pthread_key_t, dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, ) -> ::c_int1044 pub fn pthread_key_create( 1045 key: *mut pthread_key_t, 1046 dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>, 1047 ) -> ::c_int; pthread_key_delete(key: pthread_key_t) -> ::c_int1048 pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int; pthread_getspecific(key: pthread_key_t) -> *mut ::c_void1049 pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void; pthread_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int1050 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_int1051 pub fn pthread_mutex_init( 1052 lock: *mut pthread_mutex_t, 1053 attr: *const pthread_mutexattr_t, 1054 ) -> ::c_int; pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int1055 pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int1056 pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int1057 pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int; pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int1058 pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int; 1059 pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int1060 pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int; 1061 #[cfg_attr( 1062 all(target_os = "macos", target_arch = "x86"), 1063 link_name = "pthread_mutexattr_destroy$UNIX2003" 1064 )] pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int1065 pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int; pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int1066 pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int; 1067 1068 #[cfg_attr( 1069 all(target_os = "macos", target_arch = "x86"), 1070 link_name = "pthread_cond_init$UNIX2003" 1071 )] pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> ::c_int1072 pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) 1073 -> ::c_int; 1074 #[cfg_attr( 1075 all(target_os = "macos", target_arch = "x86"), 1076 link_name = "pthread_cond_wait$UNIX2003" 1077 )] pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int1078 pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int; 1079 #[cfg_attr( 1080 all(target_os = "macos", target_arch = "x86"), 1081 link_name = "pthread_cond_timedwait$UNIX2003" 1082 )] pthread_cond_timedwait( cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int1083 pub fn pthread_cond_timedwait( 1084 cond: *mut pthread_cond_t, 1085 lock: *mut pthread_mutex_t, 1086 abstime: *const ::timespec, 1087 ) -> ::c_int; pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int1088 pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int; pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int1089 pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int; pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int1090 pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int; pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int1091 pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int; pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int1092 pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int; 1093 #[cfg_attr( 1094 all(target_os = "macos", target_arch = "x86"), 1095 link_name = "pthread_rwlock_init$UNIX2003" 1096 )] pthread_rwlock_init( lock: *mut pthread_rwlock_t, attr: *const pthread_rwlockattr_t, ) -> ::c_int1097 pub fn pthread_rwlock_init( 1098 lock: *mut pthread_rwlock_t, 1099 attr: *const pthread_rwlockattr_t, 1100 ) -> ::c_int; 1101 #[cfg_attr( 1102 all(target_os = "macos", target_arch = "x86"), 1103 link_name = "pthread_rwlock_destroy$UNIX2003" 1104 )] pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int1105 pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int; 1106 #[cfg_attr( 1107 all(target_os = "macos", target_arch = "x86"), 1108 link_name = "pthread_rwlock_rdlock$UNIX2003" 1109 )] pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int1110 pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1111 #[cfg_attr( 1112 all(target_os = "macos", target_arch = "x86"), 1113 link_name = "pthread_rwlock_tryrdlock$UNIX2003" 1114 )] pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int1115 pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1116 #[cfg_attr( 1117 all(target_os = "macos", target_arch = "x86"), 1118 link_name = "pthread_rwlock_wrlock$UNIX2003" 1119 )] pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int1120 pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1121 #[cfg_attr( 1122 all(target_os = "macos", target_arch = "x86"), 1123 link_name = "pthread_rwlock_trywrlock$UNIX2003" 1124 )] pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int1125 pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int; 1126 #[cfg_attr( 1127 all(target_os = "macos", target_arch = "x86"), 1128 link_name = "pthread_rwlock_unlock$UNIX2003" 1129 )] pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int1130 pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int; pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int1131 pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int; pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int1132 pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int; 1133 1134 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")] 1135 #[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_int1136 pub fn getsockopt( 1137 sockfd: ::c_int, 1138 level: ::c_int, 1139 optname: ::c_int, 1140 optval: *mut ::c_void, 1141 optlen: *mut ::socklen_t, 1142 ) -> ::c_int; raise(signum: ::c_int) -> ::c_int1143 pub fn raise(signum: ::c_int) -> ::c_int; 1144 #[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")] sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int1145 pub fn sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int; 1146 1147 #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int1148 pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int; dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void1149 pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; dlerror() -> *mut ::c_char1150 pub fn dlerror() -> *mut ::c_char; dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void1151 pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void; dlclose(handle: *mut ::c_void) -> ::c_int1152 pub fn dlclose(handle: *mut ::c_void) -> ::c_int; dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int1153 pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; 1154 1155 #[cfg(not(all( 1156 libc_cfg_target_vendor, 1157 target_arch = "powerpc", 1158 target_vendor = "nintendo" 1159 )))] 1160 #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")] 1161 #[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_int1162 pub fn getaddrinfo( 1163 node: *const c_char, 1164 service: *const c_char, 1165 hints: *const addrinfo, 1166 res: *mut *mut addrinfo, 1167 ) -> ::c_int; 1168 #[cfg(not(all( 1169 libc_cfg_target_vendor, 1170 target_arch = "powerpc", 1171 target_vendor = "nintendo" 1172 )))] 1173 #[cfg_attr(target_os = "espidf", link_name = "lwip_freeaddrinfo")] freeaddrinfo(res: *mut addrinfo)1174 pub fn freeaddrinfo(res: *mut addrinfo); hstrerror(errcode: ::c_int) -> *const ::c_char1175 pub fn hstrerror(errcode: ::c_int) -> *const ::c_char; gai_strerror(errcode: ::c_int) -> *const ::c_char1176 pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char; 1177 #[cfg_attr( 1178 any( 1179 all(target_os = "linux", not(target_env = "musl")), 1180 target_os = "freebsd", 1181 target_os = "dragonfly", 1182 target_os = "haiku" 1183 ), 1184 link_name = "__res_init" 1185 )] 1186 #[cfg_attr(any(target_os = "macos", target_os = "ios"), link_name = "res_9_init")] res_init() -> ::c_int1187 pub fn res_init() -> ::c_int; 1188 1189 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] 1190 #[cfg_attr(target_env = "musl", allow(deprecated))] 1191 // FIXME: for `time_t` gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1192 pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 1193 #[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")] 1194 #[cfg_attr(target_env = "musl", allow(deprecated))] 1195 // FIXME: for `time_t` localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm1196 pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm; 1197 #[cfg_attr( 1198 all(target_os = "macos", target_arch = "x86"), 1199 link_name = "mktime$UNIX2003" 1200 )] 1201 #[cfg_attr(target_os = "netbsd", link_name = "__mktime50")] 1202 #[cfg_attr(target_env = "musl", allow(deprecated))] 1203 // FIXME: for `time_t` mktime(tm: *mut tm) -> time_t1204 pub fn mktime(tm: *mut tm) -> time_t; 1205 #[cfg_attr(target_os = "netbsd", link_name = "__time50")] 1206 #[cfg_attr(target_env = "musl", allow(deprecated))] 1207 // FIXME: for `time_t` time(time: *mut time_t) -> time_t1208 pub fn time(time: *mut time_t) -> time_t; 1209 #[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")] 1210 #[cfg_attr(target_env = "musl", allow(deprecated))] 1211 // FIXME: for `time_t` gmtime(time_p: *const time_t) -> *mut tm1212 pub fn gmtime(time_p: *const time_t) -> *mut tm; 1213 #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")] 1214 #[cfg_attr(target_env = "musl", allow(deprecated))] 1215 // FIXME: for `time_t` localtime(time_p: *const time_t) -> *mut tm1216 pub fn localtime(time_p: *const time_t) -> *mut tm; 1217 #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")] 1218 #[cfg_attr(target_env = "musl", allow(deprecated))] 1219 // FIXME: for `time_t` difftime(time1: time_t, time0: time_t) -> ::c_double1220 pub fn difftime(time1: time_t, time0: time_t) -> ::c_double; 1221 #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")] 1222 #[cfg_attr(target_env = "musl", allow(deprecated))] 1223 // FIXME: for `time_t` timegm(tm: *mut ::tm) -> time_t1224 pub fn timegm(tm: *mut ::tm) -> time_t; 1225 1226 #[cfg_attr(target_os = "netbsd", link_name = "__mknod50")] 1227 #[cfg_attr( 1228 all(target_os = "freebsd", any(freebsd11, freebsd10)), 1229 link_name = "mknod@FBSD_1.0" 1230 )] mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int1231 pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int; gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int1232 pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int; endservent()1233 pub fn endservent(); getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent1234 pub fn getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent; getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent1235 pub fn getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent; getservent() -> *mut servent1236 pub fn getservent() -> *mut servent; setservent(stayopen: ::c_int)1237 pub fn setservent(stayopen: ::c_int); getprotobyname(name: *const ::c_char) -> *mut protoent1238 pub fn getprotobyname(name: *const ::c_char) -> *mut protoent; getprotobynumber(proto: ::c_int) -> *mut protoent1239 pub fn getprotobynumber(proto: ::c_int) -> *mut protoent; chroot(name: *const ::c_char) -> ::c_int1240 pub fn chroot(name: *const ::c_char) -> ::c_int; 1241 #[cfg_attr( 1242 all(target_os = "macos", target_arch = "x86"), 1243 link_name = "usleep$UNIX2003" 1244 )] usleep(secs: ::c_uint) -> ::c_int1245 pub fn usleep(secs: ::c_uint) -> ::c_int; 1246 #[cfg_attr( 1247 all(target_os = "macos", target_arch = "x86"), 1248 link_name = "send$UNIX2003" 1249 )] 1250 #[cfg_attr(target_os = "espidf", link_name = "lwip_send")] send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1251 pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 1252 #[cfg_attr( 1253 all(target_os = "macos", target_arch = "x86"), 1254 link_name = "recv$UNIX2003" 1255 )] 1256 #[cfg_attr(target_os = "espidf", link_name = "lwip_recv")] recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t1257 pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 1258 #[cfg_attr( 1259 all(target_os = "macos", target_arch = "x86"), 1260 link_name = "putenv$UNIX2003" 1261 )] 1262 #[cfg_attr(target_os = "netbsd", link_name = "__putenv50")] putenv(string: *mut c_char) -> ::c_int1263 pub fn putenv(string: *mut c_char) -> ::c_int; 1264 #[cfg_attr( 1265 all(target_os = "macos", target_arch = "x86"), 1266 link_name = "poll$UNIX2003" 1267 )] poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int1268 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; 1269 #[cfg_attr( 1270 all(target_os = "macos", target_arch = "x86_64"), 1271 link_name = "select$1050" 1272 )] 1273 #[cfg_attr( 1274 all(target_os = "macos", target_arch = "x86"), 1275 link_name = "select$UNIX2003" 1276 )] 1277 #[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_int1278 pub fn select( 1279 nfds: ::c_int, 1280 readfs: *mut fd_set, 1281 writefds: *mut fd_set, 1282 errorfds: *mut fd_set, 1283 timeout: *mut timeval, 1284 ) -> ::c_int; 1285 #[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")] setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char1286 pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char; localeconv() -> *mut lconv1287 pub fn localeconv() -> *mut lconv; 1288 1289 #[cfg_attr( 1290 all(target_os = "macos", target_arch = "x86"), 1291 link_name = "sem_wait$UNIX2003" 1292 )] sem_wait(sem: *mut sem_t) -> ::c_int1293 pub fn sem_wait(sem: *mut sem_t) -> ::c_int; sem_trywait(sem: *mut sem_t) -> ::c_int1294 pub fn sem_trywait(sem: *mut sem_t) -> ::c_int; sem_post(sem: *mut sem_t) -> ::c_int1295 pub fn sem_post(sem: *mut sem_t) -> ::c_int; statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int1296 pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int; fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int1297 pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int; 1298 readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t1299 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t; 1300 1301 #[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")] sigemptyset(set: *mut sigset_t) -> ::c_int1302 pub fn sigemptyset(set: *mut sigset_t) -> ::c_int; 1303 #[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")] sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1304 pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 1305 #[cfg_attr(target_os = "netbsd", link_name = "__sigfillset14")] sigfillset(set: *mut sigset_t) -> ::c_int1306 pub fn sigfillset(set: *mut sigset_t) -> ::c_int; 1307 #[cfg_attr(target_os = "netbsd", link_name = "__sigdelset14")] sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int1308 pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int; 1309 #[cfg_attr(target_os = "netbsd", link_name = "__sigismember14")] sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int1310 pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int; 1311 1312 #[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")] sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int1313 pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int; 1314 #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")] sigpending(set: *mut sigset_t) -> ::c_int1315 pub fn sigpending(set: *mut sigset_t) -> ::c_int; 1316 sysconf(name: ::c_int) -> ::c_long1317 pub fn sysconf(name: ::c_int) -> ::c_long; 1318 mkfifo(path: *const c_char, mode: mode_t) -> ::c_int1319 pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int; 1320 1321 #[cfg_attr( 1322 all(target_os = "macos", target_arch = "x86_64"), 1323 link_name = "pselect$1050" 1324 )] 1325 #[cfg_attr( 1326 all(target_os = "macos", target_arch = "x86"), 1327 link_name = "pselect$UNIX2003" 1328 )] 1329 #[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_int1330 pub fn pselect( 1331 nfds: ::c_int, 1332 readfs: *mut fd_set, 1333 writefds: *mut fd_set, 1334 errorfds: *mut fd_set, 1335 timeout: *const timespec, 1336 sigmask: *const sigset_t, 1337 ) -> ::c_int; fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int1338 pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int; ftello(stream: *mut ::FILE) -> ::off_t1339 pub fn ftello(stream: *mut ::FILE) -> ::off_t; 1340 #[cfg_attr( 1341 all(target_os = "macos", target_arch = "x86"), 1342 link_name = "tcdrain$UNIX2003" 1343 )] tcdrain(fd: ::c_int) -> ::c_int1344 pub fn tcdrain(fd: ::c_int) -> ::c_int; cfgetispeed(termios: *const ::termios) -> ::speed_t1345 pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t; cfgetospeed(termios: *const ::termios) -> ::speed_t1346 pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t; cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1347 pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int1348 pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int; tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int1349 pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int; tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int1350 pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int; tcflow(fd: ::c_int, action: ::c_int) -> ::c_int1351 pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int; tcflush(fd: ::c_int, action: ::c_int) -> ::c_int1352 pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int; tcgetsid(fd: ::c_int) -> ::pid_t1353 pub fn tcgetsid(fd: ::c_int) -> ::pid_t; tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int1354 pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int; mkstemp(template: *mut ::c_char) -> ::c_int1355 pub fn mkstemp(template: *mut ::c_char) -> ::c_int; mkdtemp(template: *mut ::c_char) -> *mut ::c_char1356 pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char; 1357 tmpnam(ptr: *mut ::c_char) -> *mut ::c_char1358 pub fn tmpnam(ptr: *mut ::c_char) -> *mut ::c_char; 1359 openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int)1360 pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int); closelog()1361 pub fn closelog(); setlogmask(maskpri: ::c_int) -> ::c_int1362 pub fn setlogmask(maskpri: ::c_int) -> ::c_int; 1363 #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")] syslog(priority: ::c_int, message: *const ::c_char, ...)1364 pub fn syslog(priority: ::c_int, message: *const ::c_char, ...); 1365 #[cfg_attr( 1366 all(target_os = "macos", target_arch = "x86"), 1367 link_name = "nice$UNIX2003" 1368 )] nice(incr: ::c_int) -> ::c_int1369 pub fn nice(incr: ::c_int) -> ::c_int; 1370 grantpt(fd: ::c_int) -> ::c_int1371 pub fn grantpt(fd: ::c_int) -> ::c_int; posix_openpt(flags: ::c_int) -> ::c_int1372 pub fn posix_openpt(flags: ::c_int) -> ::c_int; ptsname(fd: ::c_int) -> *mut ::c_char1373 pub fn ptsname(fd: ::c_int) -> *mut ::c_char; unlockpt(fd: ::c_int) -> ::c_int1374 pub fn unlockpt(fd: ::c_int) -> ::c_int; 1375 strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char1376 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_t1377 pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t; 1378 lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int1379 pub fn lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int; 1380 } 1381 1382 cfg_if! { 1383 if #[cfg(not(target_env = "uclibc"))] { 1384 extern "C" { 1385 pub fn open_wmemstream( 1386 ptr: *mut *mut wchar_t, 1387 sizeloc: *mut size_t, 1388 ) -> *mut FILE; 1389 } 1390 } 1391 } 1392 1393 cfg_if! { 1394 if #[cfg(not(target_os = "redox"))] { 1395 extern { 1396 pub fn getsid(pid: pid_t) -> pid_t; 1397 pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; 1398 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 1399 link_name = "pause$UNIX2003")] 1400 pub fn pause() -> ::c_int; 1401 1402 pub fn readlinkat(dirfd: ::c_int, 1403 pathname: *const ::c_char, 1404 buf: *mut ::c_char, 1405 bufsiz: ::size_t) -> ::ssize_t; 1406 pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, 1407 mode: ::mode_t) -> ::c_int; 1408 pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, 1409 flags: ::c_int, ...) -> ::c_int; 1410 1411 #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), 1412 link_name = "fdopendir$INODE64")] 1413 #[cfg_attr(all(target_os = "macos", target_arch = "x86"), 1414 link_name = "fdopendir$INODE64$UNIX2003")] 1415 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; 1416 1417 #[cfg_attr(all(target_os = "macos", not(target_arch = "aarch64")), 1418 link_name = "readdir_r$INODE64")] 1419 #[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")] 1420 #[cfg_attr( 1421 all(target_os = "freebsd", any(freebsd11, freebsd10)), 1422 link_name = "readdir_r@FBSD_1.0" 1423 )] 1424 #[allow(non_autolinks)] // FIXME: `<>` breaks line length limit. 1425 /// The 64-bit libc on Solaris and illumos only has readdir_r. If a 1426 /// 32-bit Solaris or illumos target is ever created, it should use 1427 /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: 1428 /// https://illumos.org/man/3lib/libc 1429 /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html 1430 /// https://www.unix.com/man-page/opensolaris/3LIB/libc/ 1431 pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, 1432 result: *mut *mut ::dirent) -> ::c_int; 1433 } 1434 } 1435 } 1436 1437 cfg_if! { 1438 if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] { 1439 extern { 1440 pub fn cfmakeraw(termios: *mut ::termios); 1441 pub fn cfsetspeed(termios: *mut ::termios, 1442 speed: ::speed_t) -> ::c_int; 1443 } 1444 } 1445 } 1446 1447 cfg_if! { 1448 if #[cfg(target_env = "newlib")] { 1449 mod newlib; 1450 pub use self::newlib::*; 1451 } else if #[cfg(any(target_os = "linux", 1452 target_os = "l4re", 1453 target_os = "android", 1454 target_os = "emscripten"))] { 1455 mod linux_like; 1456 pub use self::linux_like::*; 1457 } else if #[cfg(any(target_os = "macos", 1458 target_os = "ios", 1459 target_os = "freebsd", 1460 target_os = "dragonfly", 1461 target_os = "openbsd", 1462 target_os = "netbsd"))] { 1463 mod bsd; 1464 pub use self::bsd::*; 1465 } else if #[cfg(any(target_os = "solaris", 1466 target_os = "illumos"))] { 1467 mod solarish; 1468 pub use self::solarish::*; 1469 } else if #[cfg(target_os = "haiku")] { 1470 mod haiku; 1471 pub use self::haiku::*; 1472 } else if #[cfg(target_os = "hermit")] { 1473 mod hermit; 1474 pub use self::hermit::*; 1475 } else if #[cfg(target_os = "redox")] { 1476 mod redox; 1477 pub use self::redox::*; 1478 } else { 1479 // Unknown target_os 1480 } 1481 } 1482 1483 cfg_if! { 1484 if #[cfg(libc_core_cvoid)] { 1485 pub use ::ffi::c_void; 1486 } else { 1487 // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help 1488 // enable more optimization opportunities around it recognizing things 1489 // like malloc/free. 1490 #[repr(u8)] 1491 #[allow(missing_copy_implementations)] 1492 #[allow(missing_debug_implementations)] 1493 pub enum c_void { 1494 // Two dummy variants so the #[repr] attribute can be used. 1495 #[doc(hidden)] 1496 __variant1, 1497 #[doc(hidden)] 1498 __variant2, 1499 } 1500 } 1501 } 1502 1503 cfg_if! { 1504 if #[cfg(libc_align)] { 1505 mod align; 1506 pub use self::align::*; 1507 } else { 1508 mod no_align; 1509 pub use self::no_align::*; 1510 } 1511 } 1512