1use super::{Send, Sync}; 2 3pub use ffi::c_void; 4 5pub type c_char = i8; 6pub type c_uchar = u8; 7pub type c_schar = i8; 8pub type c_int = i32; 9pub type c_uint = u32; 10pub type c_short = i16; 11pub type c_ushort = u16; 12pub type c_long = i32; 13pub type c_ulong = u32; 14pub type c_longlong = i64; 15pub type c_ulonglong = u64; 16pub type intmax_t = i64; 17pub type uintmax_t = u64; 18pub type size_t = usize; 19pub type ssize_t = isize; 20pub type ptrdiff_t = isize; 21pub type intptr_t = isize; 22pub type uintptr_t = usize; 23pub type off_t = i64; 24pub type pid_t = i32; 25pub type clock_t = c_longlong; 26pub type time_t = c_longlong; 27pub type c_double = f64; 28pub type c_float = f32; 29pub type ino_t = u64; 30pub type sigset_t = c_uchar; 31pub type suseconds_t = c_longlong; 32pub type mode_t = u32; 33pub type dev_t = u64; 34pub type uid_t = u32; 35pub type gid_t = u32; 36pub type nlink_t = u64; 37pub type blksize_t = c_long; 38pub type blkcnt_t = i64; 39pub type nfds_t = c_ulong; 40pub type wchar_t = i32; 41pub type nl_item = c_int; 42pub type __wasi_rights_t = u64; 43 44s_no_extra_traits! { 45 #[repr(align(16))] 46 #[allow(missing_debug_implementations)] 47 pub struct max_align_t { 48 priv_: [f64; 4] 49 } 50} 51 52#[allow(missing_copy_implementations)] 53#[cfg_attr(feature = "extra_traits", derive(Debug))] 54pub enum FILE {} 55#[allow(missing_copy_implementations)] 56#[cfg_attr(feature = "extra_traits", derive(Debug))] 57pub enum DIR {} 58#[allow(missing_copy_implementations)] 59#[cfg_attr(feature = "extra_traits", derive(Debug))] 60pub enum __locale_struct {} 61 62pub type locale_t = *mut __locale_struct; 63 64s_paren! { 65 // in wasi-libc clockid_t is const struct __clockid* (where __clockid is an opaque struct), 66 // but that's an implementation detail that we don't want to have to deal with 67 #[repr(transparent)] 68 pub struct clockid_t(*const u8); 69} 70 71unsafe impl Send for clockid_t {} 72unsafe impl Sync for clockid_t {} 73 74s! { 75 #[repr(align(8))] 76 pub struct fpos_t { 77 data: [u8; 16], 78 } 79 80 pub struct tm { 81 pub tm_sec: c_int, 82 pub tm_min: c_int, 83 pub tm_hour: c_int, 84 pub tm_mday: c_int, 85 pub tm_mon: c_int, 86 pub tm_year: c_int, 87 pub tm_wday: c_int, 88 pub tm_yday: c_int, 89 pub tm_isdst: c_int, 90 pub __tm_gmtoff: c_int, 91 pub __tm_zone: *const c_char, 92 pub __tm_nsec: c_int, 93 } 94 95 pub struct timeval { 96 pub tv_sec: time_t, 97 pub tv_usec: suseconds_t, 98 } 99 100 pub struct timespec { 101 pub tv_sec: time_t, 102 pub tv_nsec: c_long, 103 } 104 105 pub struct tms { 106 pub tms_utime: clock_t, 107 pub tms_stime: clock_t, 108 pub tms_cutime: clock_t, 109 pub tms_cstime: clock_t, 110 } 111 112 pub struct itimerspec { 113 pub it_interval: timespec, 114 pub it_value: timespec, 115 } 116 117 pub struct iovec { 118 pub iov_base: *mut c_void, 119 pub iov_len: size_t, 120 } 121 122 pub struct lconv { 123 pub decimal_point: *mut c_char, 124 pub thousands_sep: *mut c_char, 125 pub grouping: *mut c_char, 126 pub int_curr_symbol: *mut c_char, 127 pub currency_symbol: *mut c_char, 128 pub mon_decimal_point: *mut c_char, 129 pub mon_thousands_sep: *mut c_char, 130 pub mon_grouping: *mut c_char, 131 pub positive_sign: *mut c_char, 132 pub negative_sign: *mut c_char, 133 pub int_frac_digits: c_char, 134 pub frac_digits: c_char, 135 pub p_cs_precedes: c_char, 136 pub p_sep_by_space: c_char, 137 pub n_cs_precedes: c_char, 138 pub n_sep_by_space: c_char, 139 pub p_sign_posn: c_char, 140 pub n_sign_posn: c_char, 141 pub int_p_cs_precedes: c_char, 142 pub int_p_sep_by_space: c_char, 143 pub int_n_cs_precedes: c_char, 144 pub int_n_sep_by_space: c_char, 145 pub int_p_sign_posn: c_char, 146 pub int_n_sign_posn: c_char, 147 } 148 149 pub struct pollfd { 150 pub fd: c_int, 151 pub events: c_short, 152 pub revents: c_short, 153 } 154 155 pub struct rusage { 156 pub ru_utime: timeval, 157 pub ru_stime: timeval, 158 } 159 160 pub struct stat { 161 pub st_dev: dev_t, 162 pub st_ino: ino_t, 163 pub st_nlink: nlink_t, 164 pub st_mode: mode_t, 165 pub st_uid: uid_t, 166 pub st_gid: gid_t, 167 __pad0: c_uint, 168 pub st_rdev: dev_t, 169 pub st_size: off_t, 170 pub st_blksize: blksize_t, 171 pub st_blocks: blkcnt_t, 172 pub st_atim: timespec, 173 pub st_mtim: timespec, 174 pub st_ctim: timespec, 175 __reserved: [c_longlong; 3], 176 } 177} 178 179// Declare dirent outside of s! so that it doesn't implement Copy, Eq, Hash, 180// etc., since it contains a flexible array member with a dynamic size. 181#[repr(C)] 182#[allow(missing_copy_implementations)] 183#[cfg_attr(feature = "extra_traits", derive(Debug))] 184pub struct dirent { 185 pub d_ino: ino_t, 186 pub d_type: c_uchar, 187 /// d_name is declared in WASI libc as a flexible array member, which 188 /// can't be directly expressed in Rust. As an imperfect workaround, 189 /// declare it as a zero-length array instead. 190 pub d_name: [c_char; 0], 191} 192 193pub const EXIT_SUCCESS: c_int = 0; 194pub const EXIT_FAILURE: c_int = 1; 195pub const STDIN_FILENO: c_int = 0; 196pub const STDOUT_FILENO: c_int = 1; 197pub const STDERR_FILENO: c_int = 2; 198pub const SEEK_SET: c_int = 0; 199pub const SEEK_CUR: c_int = 1; 200pub const SEEK_END: c_int = 2; 201pub const _IOFBF: c_int = 0; 202pub const _IONBF: c_int = 2; 203pub const _IOLBF: c_int = 1; 204pub const F_GETFD: c_int = 1; 205pub const F_SETFD: c_int = 2; 206pub const F_GETFL: c_int = 3; 207pub const F_SETFL: c_int = 4; 208pub const FD_CLOEXEC: c_int = 1; 209pub const FD_SETSIZE: size_t = 1024; 210pub const O_APPEND: c_int = 0x0001; 211pub const O_DSYNC: c_int = 0x0002; 212pub const O_NONBLOCK: c_int = 0x0004; 213pub const O_RSYNC: c_int = 0x0008; 214pub const O_SYNC: c_int = 0x0010; 215pub const O_CREAT: c_int = 0x0001 << 12; 216pub const O_DIRECTORY: c_int = 0x0002 << 12; 217pub const O_EXCL: c_int = 0x0004 << 12; 218pub const O_TRUNC: c_int = 0x0008 << 12; 219pub const O_NOFOLLOW: c_int = 0x01000000; 220pub const O_EXEC: c_int = 0x02000000; 221pub const O_RDONLY: c_int = 0x04000000; 222pub const O_SEARCH: c_int = 0x08000000; 223pub const O_WRONLY: c_int = 0x10000000; 224pub const O_CLOEXEC: c_int = 0x0; 225pub const O_RDWR: c_int = O_WRONLY | O_RDONLY; 226pub const O_ACCMODE: c_int = O_EXEC | O_RDWR | O_SEARCH; 227pub const O_NOCTTY: c_int = 0x0; 228pub const POSIX_FADV_DONTNEED: c_int = 4; 229pub const POSIX_FADV_NOREUSE: c_int = 5; 230pub const POSIX_FADV_NORMAL: c_int = 0; 231pub const POSIX_FADV_RANDOM: c_int = 2; 232pub const POSIX_FADV_SEQUENTIAL: c_int = 1; 233pub const POSIX_FADV_WILLNEED: c_int = 3; 234pub const AT_FDCWD: ::c_int = -2; 235pub const AT_EACCESS: c_int = 0x0; 236pub const AT_SYMLINK_NOFOLLOW: c_int = 0x1; 237pub const AT_SYMLINK_FOLLOW: c_int = 0x2; 238pub const AT_REMOVEDIR: c_int = 0x4; 239pub const UTIME_OMIT: c_long = 0xfffffffe; 240pub const UTIME_NOW: c_long = 0xffffffff; 241pub const S_IFIFO: mode_t = 49152; 242pub const S_IFCHR: mode_t = 8192; 243pub const S_IFBLK: mode_t = 24576; 244pub const S_IFDIR: mode_t = 16384; 245pub const S_IFREG: mode_t = 32768; 246pub const S_IFLNK: mode_t = 40960; 247pub const S_IFSOCK: mode_t = 49152; 248pub const S_IFMT: mode_t = 57344; 249pub const S_IXOTH: mode_t = 0x1; 250pub const S_IWOTH: mode_t = 0x2; 251pub const S_IROTH: mode_t = 0x4; 252pub const S_IXGRP: mode_t = 0x8; 253pub const S_IWGRP: mode_t = 0x10; 254pub const S_IRGRP: mode_t = 0x20; 255pub const S_IXUSR: mode_t = 0x40; 256pub const S_IWUSR: mode_t = 0x80; 257pub const S_IRUSR: mode_t = 0x100; 258pub const S_ISVTX: mode_t = 0x200; 259pub const S_ISGID: mode_t = 0x400; 260pub const S_ISUID: mode_t = 0x800; 261pub const DT_UNKNOWN: u8 = 0; 262pub const DT_BLK: u8 = 1; 263pub const DT_CHR: u8 = 2; 264pub const DT_DIR: u8 = 3; 265pub const DT_REG: u8 = 4; 266pub const DT_LNK: u8 = 7; 267pub const FIONREAD: c_int = 1; 268pub const FIONBIO: c_int = 2; 269pub const F_OK: ::c_int = 0; 270pub const R_OK: ::c_int = 4; 271pub const W_OK: ::c_int = 2; 272pub const X_OK: ::c_int = 1; 273pub const POLLIN: ::c_short = 0x1; 274pub const POLLOUT: ::c_short = 0x2; 275pub const POLLERR: ::c_short = 0x1000; 276pub const POLLHUP: ::c_short = 0x2000; 277pub const POLLNVAL: ::c_short = 0x4000; 278pub const POLLRDNORM: ::c_short = 0x1; 279pub const POLLWRNORM: ::c_short = 0x2; 280 281pub const E2BIG: c_int = 1; 282pub const EACCES: c_int = 2; 283pub const EADDRINUSE: c_int = 3; 284pub const EADDRNOTAVAIL: c_int = 4; 285pub const EAFNOSUPPORT: c_int = 5; 286pub const EAGAIN: c_int = 6; 287pub const EALREADY: c_int = 7; 288pub const EBADF: c_int = 8; 289pub const EBADMSG: c_int = 9; 290pub const EBUSY: c_int = 10; 291pub const ECANCELED: c_int = 11; 292pub const ECHILD: c_int = 12; 293pub const ECONNABORTED: c_int = 13; 294pub const ECONNREFUSED: c_int = 14; 295pub const ECONNRESET: c_int = 15; 296pub const EDEADLK: c_int = 16; 297pub const EDESTADDRREQ: c_int = 17; 298pub const EDOM: c_int = 18; 299pub const EDQUOT: c_int = 19; 300pub const EEXIST: c_int = 20; 301pub const EFAULT: c_int = 21; 302pub const EFBIG: c_int = 22; 303pub const EHOSTUNREACH: c_int = 23; 304pub const EIDRM: c_int = 24; 305pub const EILSEQ: c_int = 25; 306pub const EINPROGRESS: c_int = 26; 307pub const EINTR: c_int = 27; 308pub const EINVAL: c_int = 28; 309pub const EIO: c_int = 29; 310pub const EISCONN: c_int = 30; 311pub const EISDIR: c_int = 31; 312pub const ELOOP: c_int = 32; 313pub const EMFILE: c_int = 33; 314pub const EMLINK: c_int = 34; 315pub const EMSGSIZE: c_int = 35; 316pub const EMULTIHOP: c_int = 36; 317pub const ENAMETOOLONG: c_int = 37; 318pub const ENETDOWN: c_int = 38; 319pub const ENETRESET: c_int = 39; 320pub const ENETUNREACH: c_int = 40; 321pub const ENFILE: c_int = 41; 322pub const ENOBUFS: c_int = 42; 323pub const ENODEV: c_int = 43; 324pub const ENOENT: c_int = 44; 325pub const ENOEXEC: c_int = 45; 326pub const ENOLCK: c_int = 46; 327pub const ENOLINK: c_int = 47; 328pub const ENOMEM: c_int = 48; 329pub const ENOMSG: c_int = 49; 330pub const ENOPROTOOPT: c_int = 50; 331pub const ENOSPC: c_int = 51; 332pub const ENOSYS: c_int = 52; 333pub const ENOTCONN: c_int = 53; 334pub const ENOTDIR: c_int = 54; 335pub const ENOTEMPTY: c_int = 55; 336pub const ENOTRECOVERABLE: c_int = 56; 337pub const ENOTSOCK: c_int = 57; 338pub const ENOTSUP: c_int = 58; 339pub const ENOTTY: c_int = 59; 340pub const ENXIO: c_int = 60; 341pub const EOVERFLOW: c_int = 61; 342pub const EOWNERDEAD: c_int = 62; 343pub const EPERM: c_int = 63; 344pub const EPIPE: c_int = 64; 345pub const EPROTO: c_int = 65; 346pub const EPROTONOSUPPORT: c_int = 66; 347pub const EPROTOTYPE: c_int = 67; 348pub const ERANGE: c_int = 68; 349pub const EROFS: c_int = 69; 350pub const ESPIPE: c_int = 70; 351pub const ESRCH: c_int = 71; 352pub const ESTALE: c_int = 72; 353pub const ETIMEDOUT: c_int = 73; 354pub const ETXTBSY: c_int = 74; 355pub const EXDEV: c_int = 75; 356pub const ENOTCAPABLE: c_int = 76; 357pub const EOPNOTSUPP: c_int = ENOTSUP; 358pub const EWOULDBLOCK: c_int = EAGAIN; 359 360pub const _SC_PAGESIZE: c_int = 30; 361pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; 362pub const _SC_IOV_MAX: c_int = 60; 363pub const _SC_SYMLOOP_MAX: c_int = 173; 364 365pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) }; 366pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t = 367 unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) }; 368pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) }; 369pub static CLOCK_THREAD_CPUTIME_ID: clockid_t = 370 unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) }; 371 372pub const ABDAY_1: ::nl_item = 0x20000; 373pub const ABDAY_2: ::nl_item = 0x20001; 374pub const ABDAY_3: ::nl_item = 0x20002; 375pub const ABDAY_4: ::nl_item = 0x20003; 376pub const ABDAY_5: ::nl_item = 0x20004; 377pub const ABDAY_6: ::nl_item = 0x20005; 378pub const ABDAY_7: ::nl_item = 0x20006; 379 380pub const DAY_1: ::nl_item = 0x20007; 381pub const DAY_2: ::nl_item = 0x20008; 382pub const DAY_3: ::nl_item = 0x20009; 383pub const DAY_4: ::nl_item = 0x2000A; 384pub const DAY_5: ::nl_item = 0x2000B; 385pub const DAY_6: ::nl_item = 0x2000C; 386pub const DAY_7: ::nl_item = 0x2000D; 387 388pub const ABMON_1: ::nl_item = 0x2000E; 389pub const ABMON_2: ::nl_item = 0x2000F; 390pub const ABMON_3: ::nl_item = 0x20010; 391pub const ABMON_4: ::nl_item = 0x20011; 392pub const ABMON_5: ::nl_item = 0x20012; 393pub const ABMON_6: ::nl_item = 0x20013; 394pub const ABMON_7: ::nl_item = 0x20014; 395pub const ABMON_8: ::nl_item = 0x20015; 396pub const ABMON_9: ::nl_item = 0x20016; 397pub const ABMON_10: ::nl_item = 0x20017; 398pub const ABMON_11: ::nl_item = 0x20018; 399pub const ABMON_12: ::nl_item = 0x20019; 400 401pub const MON_1: ::nl_item = 0x2001A; 402pub const MON_2: ::nl_item = 0x2001B; 403pub const MON_3: ::nl_item = 0x2001C; 404pub const MON_4: ::nl_item = 0x2001D; 405pub const MON_5: ::nl_item = 0x2001E; 406pub const MON_6: ::nl_item = 0x2001F; 407pub const MON_7: ::nl_item = 0x20020; 408pub const MON_8: ::nl_item = 0x20021; 409pub const MON_9: ::nl_item = 0x20022; 410pub const MON_10: ::nl_item = 0x20023; 411pub const MON_11: ::nl_item = 0x20024; 412pub const MON_12: ::nl_item = 0x20025; 413 414pub const AM_STR: ::nl_item = 0x20026; 415pub const PM_STR: ::nl_item = 0x20027; 416 417pub const D_T_FMT: ::nl_item = 0x20028; 418pub const D_FMT: ::nl_item = 0x20029; 419pub const T_FMT: ::nl_item = 0x2002A; 420pub const T_FMT_AMPM: ::nl_item = 0x2002B; 421 422pub const ERA: ::nl_item = 0x2002C; 423pub const ERA_D_FMT: ::nl_item = 0x2002E; 424pub const ALT_DIGITS: ::nl_item = 0x2002F; 425pub const ERA_D_T_FMT: ::nl_item = 0x20030; 426pub const ERA_T_FMT: ::nl_item = 0x20031; 427 428pub const CODESET: ::nl_item = 14; 429pub const CRNCYSTR: ::nl_item = 0x4000F; 430pub const RADIXCHAR: ::nl_item = 0x10000; 431pub const THOUSEP: ::nl_item = 0x10001; 432pub const YESEXPR: ::nl_item = 0x50000; 433pub const NOEXPR: ::nl_item = 0x50001; 434pub const YESSTR: ::nl_item = 0x50002; 435pub const NOSTR: ::nl_item = 0x50003; 436 437#[cfg_attr( 438 feature = "rustc-dep-of-std", 439 link( 440 name = "c", 441 kind = "static", 442 modifiers = "-bundle", 443 cfg(target_feature = "crt-static") 444 ) 445)] 446#[cfg_attr( 447 feature = "rustc-dep-of-std", 448 link(name = "c", cfg(not(target_feature = "crt-static"))) 449)] 450extern "C" { 451 pub fn _Exit(code: c_int) -> !; 452 pub fn _exit(code: c_int) -> !; 453 pub fn abort() -> !; 454 pub fn aligned_alloc(a: size_t, b: size_t) -> *mut c_void; 455 pub fn calloc(amt: size_t, amt2: size_t) -> *mut c_void; 456 pub fn exit(code: c_int) -> !; 457 pub fn free(ptr: *mut c_void); 458 pub fn getenv(s: *const c_char) -> *mut c_char; 459 pub fn malloc(amt: size_t) -> *mut c_void; 460 pub fn malloc_usable_size(ptr: *mut c_void) -> size_t; 461 pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; 462 pub fn rand() -> c_int; 463 pub fn read(fd: c_int, ptr: *mut c_void, size: size_t) -> ssize_t; 464 pub fn realloc(ptr: *mut c_void, amt: size_t) -> *mut c_void; 465 pub fn setenv(k: *const c_char, v: *const c_char, a: c_int) -> c_int; 466 pub fn unsetenv(k: *const c_char) -> c_int; 467 pub fn clearenv() -> ::c_int; 468 pub fn write(fd: c_int, ptr: *const c_void, size: size_t) -> ssize_t; 469 pub static mut environ: *mut *mut c_char; 470 pub fn fopen(a: *const c_char, b: *const c_char) -> *mut FILE; 471 pub fn freopen(a: *const c_char, b: *const c_char, f: *mut FILE) -> *mut FILE; 472 pub fn fclose(f: *mut FILE) -> c_int; 473 pub fn remove(a: *const c_char) -> c_int; 474 pub fn rename(a: *const c_char, b: *const c_char) -> c_int; 475 pub fn feof(f: *mut FILE) -> c_int; 476 pub fn ferror(f: *mut FILE) -> c_int; 477 pub fn fflush(f: *mut FILE) -> c_int; 478 pub fn clearerr(f: *mut FILE); 479 pub fn fseek(f: *mut FILE, b: c_long, c: c_int) -> c_int; 480 pub fn ftell(f: *mut FILE) -> c_long; 481 pub fn rewind(f: *mut FILE); 482 pub fn fgetpos(f: *mut FILE, pos: *mut fpos_t) -> c_int; 483 pub fn fsetpos(f: *mut FILE, pos: *const fpos_t) -> c_int; 484 pub fn fread(buf: *mut c_void, a: size_t, b: size_t, f: *mut FILE) -> size_t; 485 pub fn fwrite(buf: *const c_void, a: size_t, b: size_t, f: *mut FILE) -> size_t; 486 pub fn fgetc(f: *mut FILE) -> c_int; 487 pub fn getc(f: *mut FILE) -> c_int; 488 pub fn getchar() -> c_int; 489 pub fn ungetc(a: c_int, f: *mut FILE) -> c_int; 490 pub fn fputc(a: c_int, f: *mut FILE) -> c_int; 491 pub fn putc(a: c_int, f: *mut FILE) -> c_int; 492 pub fn putchar(a: c_int) -> c_int; 493 pub fn fputs(a: *const c_char, f: *mut FILE) -> c_int; 494 pub fn puts(a: *const c_char) -> c_int; 495 pub fn perror(a: *const c_char); 496 pub fn srand(a: c_uint); 497 pub fn atexit(a: extern "C" fn()) -> c_int; 498 pub fn at_quick_exit(a: extern "C" fn()) -> c_int; 499 pub fn quick_exit(a: c_int) -> !; 500 pub fn posix_memalign(a: *mut *mut c_void, b: size_t, c: size_t) -> c_int; 501 pub fn rand_r(a: *mut c_uint) -> c_int; 502 pub fn random() -> c_long; 503 pub fn srandom(a: c_uint); 504 pub fn putenv(a: *mut c_char) -> c_int; 505 pub fn clock() -> clock_t; 506 pub fn time(a: *mut time_t) -> time_t; 507 pub fn difftime(a: time_t, b: time_t) -> c_double; 508 pub fn mktime(a: *mut tm) -> time_t; 509 pub fn strftime(a: *mut c_char, b: size_t, c: *const c_char, d: *const tm) -> size_t; 510 pub fn gmtime(a: *const time_t) -> *mut tm; 511 pub fn gmtime_r(a: *const time_t, b: *mut tm) -> *mut tm; 512 pub fn localtime(a: *const time_t) -> *mut tm; 513 pub fn localtime_r(a: *const time_t, b: *mut tm) -> *mut tm; 514 pub fn asctime_r(a: *const tm, b: *mut c_char) -> *mut c_char; 515 pub fn ctime_r(a: *const time_t, b: *mut c_char) -> *mut c_char; 516 517 static _CLOCK_MONOTONIC: u8; 518 static _CLOCK_PROCESS_CPUTIME_ID: u8; 519 static _CLOCK_REALTIME: u8; 520 static _CLOCK_THREAD_CPUTIME_ID: u8; 521 pub fn nanosleep(a: *const timespec, b: *mut timespec) -> c_int; 522 pub fn clock_getres(a: clockid_t, b: *mut timespec) -> c_int; 523 pub fn clock_gettime(a: clockid_t, b: *mut timespec) -> c_int; 524 pub fn clock_nanosleep(a: clockid_t, a2: c_int, b: *const timespec, c: *mut timespec) -> c_int; 525 526 pub fn isalnum(c: c_int) -> c_int; 527 pub fn isalpha(c: c_int) -> c_int; 528 pub fn iscntrl(c: c_int) -> c_int; 529 pub fn isdigit(c: c_int) -> c_int; 530 pub fn isgraph(c: c_int) -> c_int; 531 pub fn islower(c: c_int) -> c_int; 532 pub fn isprint(c: c_int) -> c_int; 533 pub fn ispunct(c: c_int) -> c_int; 534 pub fn isspace(c: c_int) -> c_int; 535 pub fn isupper(c: c_int) -> c_int; 536 pub fn isxdigit(c: c_int) -> c_int; 537 pub fn isblank(c: c_int) -> c_int; 538 pub fn tolower(c: c_int) -> c_int; 539 pub fn toupper(c: c_int) -> c_int; 540 pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int; 541 pub fn setbuf(stream: *mut FILE, buf: *mut c_char); 542 pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char; 543 pub fn atof(s: *const c_char) -> c_double; 544 pub fn atoi(s: *const c_char) -> c_int; 545 pub fn atol(s: *const c_char) -> c_long; 546 pub fn atoll(s: *const c_char) -> c_longlong; 547 pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double; 548 pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float; 549 pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long; 550 pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong; 551 pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong; 552 pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong; 553 554 pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char; 555 pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; 556 pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char; 557 pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char; 558 pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int; 559 pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int; 560 pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int; 561 pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char; 562 pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char; 563 pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; 564 pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; 565 pub fn strdup(cs: *const c_char) -> *mut c_char; 566 pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char; 567 pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; 568 pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; 569 pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; 570 pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int; 571 pub fn strlen(cs: *const c_char) -> size_t; 572 pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t; 573 pub fn strerror(n: c_int) -> *mut c_char; 574 pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; 575 pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; 576 577 pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; 578 pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; 579 pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; 580 pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; 581 pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; 582 583 pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; 584 pub fn printf(format: *const ::c_char, ...) -> ::c_int; 585 pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int; 586 pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int; 587 pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int; 588 pub fn scanf(format: *const ::c_char, ...) -> ::c_int; 589 pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int; 590 pub fn getchar_unlocked() -> ::c_int; 591 pub fn putchar_unlocked(c: ::c_int) -> ::c_int; 592 593 pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int; 594 pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int; 595 pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int; 596 pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int; 597 pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE; 598 pub fn fileno(stream: *mut ::FILE) -> ::c_int; 599 pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int; 600 pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int; 601 pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int; 602 pub fn opendir(dirname: *const c_char) -> *mut ::DIR; 603 pub fn fdopendir(fd: ::c_int) -> *mut ::DIR; 604 pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent; 605 pub fn closedir(dirp: *mut ::DIR) -> ::c_int; 606 pub fn rewinddir(dirp: *mut ::DIR); 607 pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; 608 pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); 609 pub fn telldir(dirp: *mut ::DIR) -> ::c_long; 610 611 pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ...) -> ::c_int; 612 pub fn fstatat( 613 dirfd: ::c_int, 614 pathname: *const ::c_char, 615 buf: *mut stat, 616 flags: ::c_int, 617 ) -> ::c_int; 618 pub fn linkat( 619 olddirfd: ::c_int, 620 oldpath: *const ::c_char, 621 newdirfd: ::c_int, 622 newpath: *const ::c_char, 623 flags: ::c_int, 624 ) -> ::c_int; 625 pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int; 626 pub fn readlinkat( 627 dirfd: ::c_int, 628 pathname: *const ::c_char, 629 buf: *mut ::c_char, 630 bufsiz: ::size_t, 631 ) -> ::ssize_t; 632 pub fn renameat( 633 olddirfd: ::c_int, 634 oldpath: *const ::c_char, 635 newdirfd: ::c_int, 636 newpath: *const ::c_char, 637 ) -> ::c_int; 638 pub fn symlinkat( 639 target: *const ::c_char, 640 newdirfd: ::c_int, 641 linkpath: *const ::c_char, 642 ) -> ::c_int; 643 pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int; 644 645 pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int; 646 pub fn close(fd: ::c_int) -> ::c_int; 647 pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; 648 pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int; 649 pub fn isatty(fd: ::c_int) -> ::c_int; 650 pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int; 651 pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t; 652 pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; 653 pub fn rmdir(path: *const c_char) -> ::c_int; 654 pub fn sleep(secs: ::c_uint) -> ::c_uint; 655 pub fn unlink(c: *const c_char) -> ::c_int; 656 pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; 657 pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t; 658 659 pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int; 660 661 pub fn fsync(fd: ::c_int) -> ::c_int; 662 pub fn fdatasync(fd: ::c_int) -> ::c_int; 663 664 pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int; 665 666 pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; 667 pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int; 668 669 pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; 670 671 pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; 672 pub fn times(buf: *mut ::tms) -> ::clock_t; 673 674 pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int; 675 676 pub fn usleep(secs: ::c_uint) -> ::c_int; 677 pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 678 pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t; 679 pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int; 680 pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char; 681 pub fn localeconv() -> *mut lconv; 682 683 pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t; 684 685 pub fn timegm(tm: *mut ::tm) -> time_t; 686 687 pub fn sysconf(name: ::c_int) -> ::c_long; 688 689 pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; 690 691 pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int; 692 pub fn ftello(stream: *mut ::FILE) -> ::off_t; 693 pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int; 694 695 pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char; 696 pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t; 697 698 pub fn faccessat( 699 dirfd: ::c_int, 700 pathname: *const ::c_char, 701 mode: ::c_int, 702 flags: ::c_int, 703 ) -> ::c_int; 704 pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; 705 pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; 706 pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) 707 -> ::ssize_t; 708 pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t; 709 pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int; 710 pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; 711 pub fn utimensat( 712 dirfd: ::c_int, 713 path: *const ::c_char, 714 times: *const ::timespec, 715 flag: ::c_int, 716 ) -> ::c_int; 717 pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; 718 pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void; 719 pub fn abs(i: c_int) -> c_int; 720 pub fn labs(i: c_long) -> c_long; 721 pub fn duplocale(base: ::locale_t) -> ::locale_t; 722 pub fn freelocale(loc: ::locale_t); 723 pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t; 724 pub fn uselocale(loc: ::locale_t) -> ::locale_t; 725 pub fn sched_yield() -> ::c_int; 726 pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; 727 pub fn chdir(dir: *const c_char) -> ::c_int; 728 729 pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; 730 pub fn nl_langinfo_l(item: ::nl_item, loc: ::locale_t) -> *mut ::c_char; 731 732 pub fn __wasilibc_register_preopened_fd(fd: c_int, path: *const c_char) -> c_int; 733 pub fn __wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int; 734 pub fn __wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int; 735 pub fn __wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int; 736 pub fn __wasilibc_find_relpath( 737 path: *const c_char, 738 abs_prefix: *mut *const c_char, 739 relative_path: *mut *mut c_char, 740 relative_path_len: usize, 741 ) -> c_int; 742 pub fn __wasilibc_tell(fd: c_int) -> ::off_t; 743 pub fn __wasilibc_nocwd___wasilibc_unlinkat(dirfd: c_int, path: *const c_char) -> c_int; 744 pub fn __wasilibc_nocwd___wasilibc_rmdirat(dirfd: c_int, path: *const c_char) -> c_int; 745 pub fn __wasilibc_nocwd_linkat( 746 olddirfd: c_int, 747 oldpath: *const c_char, 748 newdirfd: c_int, 749 newpath: *const c_char, 750 flags: c_int, 751 ) -> c_int; 752 pub fn __wasilibc_nocwd_symlinkat( 753 target: *const c_char, 754 dirfd: c_int, 755 path: *const c_char, 756 ) -> c_int; 757 pub fn __wasilibc_nocwd_readlinkat( 758 dirfd: c_int, 759 path: *const c_char, 760 buf: *mut c_char, 761 bufsize: usize, 762 ) -> isize; 763 pub fn __wasilibc_nocwd_faccessat( 764 dirfd: c_int, 765 path: *const c_char, 766 mode: c_int, 767 flags: c_int, 768 ) -> c_int; 769 pub fn __wasilibc_nocwd_renameat( 770 olddirfd: c_int, 771 oldpath: *const c_char, 772 newdirfd: c_int, 773 newpath: *const c_char, 774 ) -> c_int; 775 pub fn __wasilibc_nocwd_openat_nomode(dirfd: c_int, path: *const c_char, flags: c_int) 776 -> c_int; 777 pub fn __wasilibc_nocwd_fstatat( 778 dirfd: c_int, 779 path: *const c_char, 780 buf: *mut stat, 781 flags: c_int, 782 ) -> c_int; 783 pub fn __wasilibc_nocwd_mkdirat_nomode(dirfd: c_int, path: *const c_char) -> c_int; 784 pub fn __wasilibc_nocwd_utimensat( 785 dirfd: c_int, 786 path: *const c_char, 787 times: *const ::timespec, 788 flags: c_int, 789 ) -> c_int; 790 pub fn __wasilibc_nocwd_opendirat(dirfd: c_int, path: *const c_char) -> *mut ::DIR; 791 pub fn __wasilibc_access(pathname: *const c_char, mode: c_int, flags: c_int) -> c_int; 792 pub fn __wasilibc_stat(pathname: *const c_char, buf: *mut stat, flags: c_int) -> c_int; 793 pub fn __wasilibc_utimens( 794 pathname: *const c_char, 795 times: *const ::timespec, 796 flags: c_int, 797 ) -> c_int; 798 pub fn __wasilibc_link(oldpath: *const c_char, newpath: *const c_char, flags: c_int) -> c_int; 799 pub fn __wasilibc_link_oldat( 800 olddirfd: c_int, 801 oldpath: *const c_char, 802 newpath: *const c_char, 803 flags: c_int, 804 ) -> c_int; 805 pub fn __wasilibc_link_newat( 806 oldpath: *const c_char, 807 newdirfd: c_int, 808 newpath: *const c_char, 809 flags: c_int, 810 ) -> c_int; 811 pub fn __wasilibc_rename_oldat( 812 olddirfd: c_int, 813 oldpath: *const c_char, 814 newpath: *const c_char, 815 ) -> c_int; 816 pub fn __wasilibc_rename_newat( 817 oldpath: *const c_char, 818 newdirfd: c_int, 819 newpath: *const c_char, 820 ) -> c_int; 821 822 pub fn arc4random() -> u32; 823 pub fn arc4random_buf(a: *mut c_void, b: size_t); 824 pub fn arc4random_uniform(a: u32) -> u32; 825} 826