1 pub use ffi::c_void;
2 
3 pub type c_char = i8;
4 pub type c_uchar = u8;
5 pub type c_schar = i8;
6 pub type c_int = i32;
7 pub type c_uint = u32;
8 pub type c_short = i16;
9 pub type c_ushort = u16;
10 pub type c_long = i32;
11 pub type c_ulong = u32;
12 pub type c_longlong = i64;
13 pub type c_ulonglong = u64;
14 pub type intmax_t = i64;
15 pub type uintmax_t = u64;
16 pub type size_t = usize;
17 pub type ssize_t = isize;
18 pub type ptrdiff_t = isize;
19 pub type intptr_t = isize;
20 pub type uintptr_t = usize;
21 pub type off_t = i64;
22 pub type pid_t = i32;
23 pub type clock_t = c_longlong;
24 pub type time_t = c_longlong;
25 pub type c_double = f64;
26 pub type c_float = f32;
27 pub type ino_t = u64;
28 pub type sigset_t = c_uchar;
29 pub type suseconds_t = c_longlong;
30 pub type mode_t = u32;
31 pub type dev_t = u64;
32 pub type uid_t = u32;
33 pub type gid_t = u32;
34 pub type nlink_t = u64;
35 pub type blksize_t = c_long;
36 pub type blkcnt_t = i64;
37 pub type nfds_t = c_ulong;
38 
39 pub type __wasi_rights_t = u64;
40 
41 #[allow(missing_copy_implementations)]
42 #[cfg_attr(feature = "extra_traits", derive(Debug))]
43 pub enum FILE {}
44 #[allow(missing_copy_implementations)]
45 #[cfg_attr(feature = "extra_traits", derive(Debug))]
46 pub enum DIR {}
47 #[allow(missing_copy_implementations)]
48 #[cfg_attr(feature = "extra_traits", derive(Debug))]
49 pub enum __locale_struct {}
50 
51 pub type locale_t = *mut __locale_struct;
52 
53 s! {
54     #[repr(align(8))]
55     pub struct fpos_t {
56         data: [u8; 16],
57     }
58 
59     pub struct tm {
60         pub tm_sec: c_int,
61         pub tm_min: c_int,
62         pub tm_hour: c_int,
63         pub tm_mday: c_int,
64         pub tm_mon: c_int,
65         pub tm_year: c_int,
66         pub tm_wday: c_int,
67         pub tm_yday: c_int,
68         pub tm_isdst: c_int,
69         pub __tm_gmtoff: c_int,
70         pub __tm_zone: *const c_char,
71         pub __tm_nsec: c_int,
72     }
73 
74     pub struct timeval {
75         pub tv_sec: time_t,
76         pub tv_usec: suseconds_t,
77     }
78 
79     pub struct timespec {
80         pub tv_sec: time_t,
81         pub tv_nsec: c_long,
82     }
83 
84     pub struct tms {
85         pub tms_utime: clock_t,
86         pub tms_stime: clock_t,
87         pub tms_cutime: clock_t,
88         pub tms_cstime: clock_t,
89     }
90 
91     pub struct itimerspec {
92         pub it_interval: timespec,
93         pub it_value: timespec,
94     }
95 
96     pub struct iovec {
97         pub iov_base: *mut c_void,
98         pub iov_len: size_t,
99     }
100 
101     pub struct lconv {
102         pub decimal_point: *mut c_char,
103         pub thousands_sep: *mut c_char,
104         pub grouping: *mut c_char,
105         pub int_curr_symbol: *mut c_char,
106         pub currency_symbol: *mut c_char,
107         pub mon_decimal_point: *mut c_char,
108         pub mon_thousands_sep: *mut c_char,
109         pub mon_grouping: *mut c_char,
110         pub positive_sign: *mut c_char,
111         pub negative_sign: *mut c_char,
112         pub int_frac_digits: c_char,
113         pub frac_digits: c_char,
114         pub p_cs_precedes: c_char,
115         pub p_sep_by_space: c_char,
116         pub n_cs_precedes: c_char,
117         pub n_sep_by_space: c_char,
118         pub p_sign_posn: c_char,
119         pub n_sign_posn: c_char,
120         pub int_p_cs_precedes: c_char,
121         pub int_p_sep_by_space: c_char,
122         pub int_n_cs_precedes: c_char,
123         pub int_n_sep_by_space: c_char,
124         pub int_p_sign_posn: c_char,
125         pub int_n_sign_posn: c_char,
126     }
127 
128     pub struct pollfd {
129         pub fd: c_int,
130         pub events: c_short,
131         pub revents: c_short,
132     }
133 
134     pub struct rusage {
135         pub ru_utime: timeval,
136         pub ru_stime: timeval,
137     }
138 
139     pub struct stat {
140         pub st_dev: dev_t,
141         pub st_ino: ino_t,
142         pub st_nlink: nlink_t,
143         pub st_mode: mode_t,
144         pub st_uid: uid_t,
145         pub st_gid: gid_t,
146         __pad0: c_uint,
147         pub st_rdev: dev_t,
148         pub st_size: off_t,
149         pub st_blksize: blksize_t,
150         pub st_blocks: blkcnt_t,
151         pub st_atim: timespec,
152         pub st_mtim: timespec,
153         pub st_ctim: timespec,
154         __reserved: [c_longlong; 3],
155     }
156 }
157 
158 // Declare dirent outside of s! so that it doesn't implement Copy, Eq, Hash,
159 // etc., since it contains a flexible array member with a dynamic size.
160 #[repr(C)]
161 #[allow(missing_copy_implementations)]
162 #[cfg_attr(feature = "extra_traits", derive(Debug))]
163 pub struct dirent {
164     pub d_ino: ino_t,
165     pub d_type: c_uchar,
166     /// d_name is declared in WASI libc as a flexible array member, which
167     /// can't be directly expressed in Rust. As an imperfect workaround,
168     /// declare it as a zero-length array instead.
169     pub d_name: [c_char; 0],
170 }
171 
172 pub const EXIT_SUCCESS: c_int = 0;
173 pub const EXIT_FAILURE: c_int = 1;
174 pub const STDIN_FILENO: c_int = 0;
175 pub const STDOUT_FILENO: c_int = 1;
176 pub const STDERR_FILENO: c_int = 2;
177 pub const SEEK_SET: c_int = 0;
178 pub const SEEK_CUR: c_int = 1;
179 pub const SEEK_END: c_int = 2;
180 pub const _IOFBF: c_int = 0;
181 pub const _IONBF: c_int = 2;
182 pub const _IOLBF: c_int = 1;
183 pub const F_GETFD: c_int = 1;
184 pub const F_SETFD: c_int = 2;
185 pub const F_GETFL: c_int = 3;
186 pub const F_SETFL: c_int = 4;
187 pub const FD_CLOEXEC: c_int = 1;
188 pub const FD_SETSIZE: size_t = 1024;
189 pub const O_APPEND: c_int = 0x0001;
190 pub const O_DSYNC: c_int = 0x0002;
191 pub const O_NONBLOCK: c_int = 0x0004;
192 pub const O_RSYNC: c_int = 0x0008;
193 pub const O_SYNC: c_int = 0x0010;
194 pub const O_CREAT: c_int = 0x0001 << 12;
195 pub const O_DIRECTORY: c_int = 0x0002 << 12;
196 pub const O_EXCL: c_int = 0x0004 << 12;
197 pub const O_TRUNC: c_int = 0x0008 << 12;
198 pub const O_NOFOLLOW: c_int = 0x01000000;
199 pub const O_EXEC: c_int = 0x02000000;
200 pub const O_RDONLY: c_int = 0x04000000;
201 pub const O_SEARCH: c_int = 0x08000000;
202 pub const O_WRONLY: c_int = 0x10000000;
203 pub const O_RDWR: c_int = O_WRONLY | O_RDONLY;
204 pub const O_ACCMODE: c_int = O_EXEC | O_RDWR | O_SEARCH;
205 pub const POSIX_FADV_DONTNEED: c_int = 4;
206 pub const POSIX_FADV_NOREUSE: c_int = 5;
207 pub const POSIX_FADV_NORMAL: c_int = 0;
208 pub const POSIX_FADV_RANDOM: c_int = 2;
209 pub const POSIX_FADV_SEQUENTIAL: c_int = 1;
210 pub const POSIX_FADV_WILLNEED: c_int = 3;
211 pub const AT_EACCESS: c_int = 0x0;
212 pub const AT_SYMLINK_NOFOLLOW: c_int = 0x1;
213 pub const AT_SYMLINK_FOLLOW: c_int = 0x2;
214 pub const AT_REMOVEDIR: c_int = 0x4;
215 pub const UTIME_OMIT: c_long = 0xfffffffe;
216 pub const UTIME_NOW: c_long = 0xffffffff;
217 pub const S_IFIFO: mode_t = 49152;
218 pub const S_IFCHR: mode_t = 8192;
219 pub const S_IFBLK: mode_t = 24576;
220 pub const S_IFDIR: mode_t = 16384;
221 pub const S_IFREG: mode_t = 32768;
222 pub const S_IFLNK: mode_t = 40960;
223 pub const S_IFSOCK: mode_t = 49152;
224 pub const S_IFMT: mode_t = 57344;
225 pub const DT_UNKNOWN: u8 = 0;
226 pub const DT_BLK: u8 = 1;
227 pub const DT_CHR: u8 = 2;
228 pub const DT_DIR: u8 = 3;
229 pub const DT_REG: u8 = 4;
230 pub const DT_LNK: u8 = 7;
231 pub const FIONREAD: c_int = 1;
232 pub const FIONBIO: c_int = 2;
233 
234 pub const E2BIG: c_int = 1;
235 pub const EACCES: c_int = 2;
236 pub const EADDRINUSE: c_int = 3;
237 pub const EADDRNOTAVAIL: c_int = 4;
238 pub const EAFNOSUPPORT: c_int = 5;
239 pub const EAGAIN: c_int = 6;
240 pub const EALREADY: c_int = 7;
241 pub const EBADF: c_int = 8;
242 pub const EBADMSG: c_int = 9;
243 pub const EBUSY: c_int = 10;
244 pub const ECANCELED: c_int = 11;
245 pub const ECHILD: c_int = 12;
246 pub const ECONNABORTED: c_int = 13;
247 pub const ECONNREFUSED: c_int = 14;
248 pub const ECONNRESET: c_int = 15;
249 pub const EDEADLK: c_int = 16;
250 pub const EDESTADDRREQ: c_int = 17;
251 pub const EDOM: c_int = 18;
252 pub const EDQUOT: c_int = 19;
253 pub const EEXIST: c_int = 20;
254 pub const EFAULT: c_int = 21;
255 pub const EFBIG: c_int = 22;
256 pub const EHOSTUNREACH: c_int = 23;
257 pub const EIDRM: c_int = 24;
258 pub const EILSEQ: c_int = 25;
259 pub const EINPROGRESS: c_int = 26;
260 pub const EINTR: c_int = 27;
261 pub const EINVAL: c_int = 28;
262 pub const EIO: c_int = 29;
263 pub const EISCONN: c_int = 30;
264 pub const EISDIR: c_int = 31;
265 pub const ELOOP: c_int = 32;
266 pub const EMFILE: c_int = 33;
267 pub const EMLINK: c_int = 34;
268 pub const EMSGSIZE: c_int = 35;
269 pub const EMULTIHOP: c_int = 36;
270 pub const ENAMETOOLONG: c_int = 37;
271 pub const ENETDOWN: c_int = 38;
272 pub const ENETRESET: c_int = 39;
273 pub const ENETUNREACH: c_int = 40;
274 pub const ENFILE: c_int = 41;
275 pub const ENOBUFS: c_int = 42;
276 pub const ENODEV: c_int = 43;
277 pub const ENOENT: c_int = 44;
278 pub const ENOEXEC: c_int = 45;
279 pub const ENOLCK: c_int = 46;
280 pub const ENOLINK: c_int = 47;
281 pub const ENOMEM: c_int = 48;
282 pub const ENOMSG: c_int = 49;
283 pub const ENOPROTOOPT: c_int = 50;
284 pub const ENOSPC: c_int = 51;
285 pub const ENOSYS: c_int = 52;
286 pub const ENOTCONN: c_int = 53;
287 pub const ENOTDIR: c_int = 54;
288 pub const ENOTEMPTY: c_int = 55;
289 pub const ENOTRECOVERABLE: c_int = 56;
290 pub const ENOTSOCK: c_int = 57;
291 pub const ENOTSUP: c_int = 58;
292 pub const ENOTTY: c_int = 59;
293 pub const ENXIO: c_int = 60;
294 pub const EOVERFLOW: c_int = 61;
295 pub const EOWNERDEAD: c_int = 62;
296 pub const EPERM: c_int = 63;
297 pub const EPIPE: c_int = 64;
298 pub const EPROTO: c_int = 65;
299 pub const EPROTONOSUPPORT: c_int = 66;
300 pub const EPROTOTYPE: c_int = 67;
301 pub const ERANGE: c_int = 68;
302 pub const EROFS: c_int = 69;
303 pub const ESPIPE: c_int = 70;
304 pub const ESRCH: c_int = 71;
305 pub const ESTALE: c_int = 72;
306 pub const ETIMEDOUT: c_int = 73;
307 pub const ETXTBSY: c_int = 74;
308 pub const EXDEV: c_int = 75;
309 pub const ENOTCAPABLE: c_int = 76;
310 pub const EOPNOTSUPP: c_int = ENOTSUP;
311 pub const EWOULDBLOCK: c_int = EAGAIN;
312 
313 #[cfg_attr(
314     feature = "rustc-dep-of-std",
315     link(name = "c", kind = "static", cfg(target_feature = "crt-static"))
316 )]
317 #[cfg_attr(
318     feature = "rustc-dep-of-std",
319     link(name = "c", cfg(not(target_feature = "crt-static")))
320 )]
321 extern "C" {
_Exit(code: c_int) -> !322     pub fn _Exit(code: c_int) -> !;
_exit(code: c_int) -> !323     pub fn _exit(code: c_int) -> !;
abort() -> !324     pub fn abort() -> !;
aligned_alloc(a: size_t, b: size_t) -> *mut c_void325     pub fn aligned_alloc(a: size_t, b: size_t) -> *mut c_void;
calloc(amt: size_t, amt2: size_t) -> *mut c_void326     pub fn calloc(amt: size_t, amt2: size_t) -> *mut c_void;
exit(code: c_int) -> !327     pub fn exit(code: c_int) -> !;
free(ptr: *mut c_void)328     pub fn free(ptr: *mut c_void);
getenv(s: *const c_char) -> *mut c_char329     pub fn getenv(s: *const c_char) -> *mut c_char;
malloc(amt: size_t) -> *mut c_void330     pub fn malloc(amt: size_t) -> *mut c_void;
malloc_usable_size(ptr: *mut c_void) -> size_t331     pub fn malloc_usable_size(ptr: *mut c_void) -> size_t;
sbrk(increment: ::intptr_t) -> *mut ::c_void332     pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
rand() -> c_int333     pub fn rand() -> c_int;
read(fd: c_int, ptr: *mut c_void, size: size_t) -> ssize_t334     pub fn read(fd: c_int, ptr: *mut c_void, size: size_t) -> ssize_t;
realloc(ptr: *mut c_void, amt: size_t) -> *mut c_void335     pub fn realloc(ptr: *mut c_void, amt: size_t) -> *mut c_void;
setenv(k: *const c_char, v: *const c_char, a: c_int) -> c_int336     pub fn setenv(k: *const c_char, v: *const c_char, a: c_int) -> c_int;
unsetenv(k: *const c_char) -> c_int337     pub fn unsetenv(k: *const c_char) -> c_int;
clearenv() -> ::c_int338     pub fn clearenv() -> ::c_int;
write(fd: c_int, ptr: *const c_void, size: size_t) -> ssize_t339     pub fn write(fd: c_int, ptr: *const c_void, size: size_t) -> ssize_t;
340     pub static mut environ: *mut *mut c_char;
fopen(a: *const c_char, b: *const c_char) -> *mut FILE341     pub fn fopen(a: *const c_char, b: *const c_char) -> *mut FILE;
freopen( a: *const c_char, b: *const c_char, f: *mut FILE, ) -> *mut FILE342     pub fn freopen(
343         a: *const c_char,
344         b: *const c_char,
345         f: *mut FILE,
346     ) -> *mut FILE;
fclose(f: *mut FILE) -> c_int347     pub fn fclose(f: *mut FILE) -> c_int;
remove(a: *const c_char) -> c_int348     pub fn remove(a: *const c_char) -> c_int;
rename(a: *const c_char, b: *const c_char) -> c_int349     pub fn rename(a: *const c_char, b: *const c_char) -> c_int;
feof(f: *mut FILE) -> c_int350     pub fn feof(f: *mut FILE) -> c_int;
ferror(f: *mut FILE) -> c_int351     pub fn ferror(f: *mut FILE) -> c_int;
fflush(f: *mut FILE) -> c_int352     pub fn fflush(f: *mut FILE) -> c_int;
clearerr(f: *mut FILE)353     pub fn clearerr(f: *mut FILE);
fseek(f: *mut FILE, b: c_long, c: c_int) -> c_int354     pub fn fseek(f: *mut FILE, b: c_long, c: c_int) -> c_int;
ftell(f: *mut FILE) -> c_long355     pub fn ftell(f: *mut FILE) -> c_long;
rewind(f: *mut FILE)356     pub fn rewind(f: *mut FILE);
fgetpos(f: *mut FILE, pos: *mut fpos_t) -> c_int357     pub fn fgetpos(f: *mut FILE, pos: *mut fpos_t) -> c_int;
fsetpos(f: *mut FILE, pos: *const fpos_t) -> c_int358     pub fn fsetpos(f: *mut FILE, pos: *const fpos_t) -> c_int;
fread( buf: *mut c_void, a: size_t, b: size_t, f: *mut FILE, ) -> size_t359     pub fn fread(
360         buf: *mut c_void,
361         a: size_t,
362         b: size_t,
363         f: *mut FILE,
364     ) -> size_t;
fwrite( buf: *const c_void, a: size_t, b: size_t, f: *mut FILE, ) -> size_t365     pub fn fwrite(
366         buf: *const c_void,
367         a: size_t,
368         b: size_t,
369         f: *mut FILE,
370     ) -> size_t;
fgetc(f: *mut FILE) -> c_int371     pub fn fgetc(f: *mut FILE) -> c_int;
getc(f: *mut FILE) -> c_int372     pub fn getc(f: *mut FILE) -> c_int;
getchar() -> c_int373     pub fn getchar() -> c_int;
ungetc(a: c_int, f: *mut FILE) -> c_int374     pub fn ungetc(a: c_int, f: *mut FILE) -> c_int;
fputc(a: c_int, f: *mut FILE) -> c_int375     pub fn fputc(a: c_int, f: *mut FILE) -> c_int;
putc(a: c_int, f: *mut FILE) -> c_int376     pub fn putc(a: c_int, f: *mut FILE) -> c_int;
putchar(a: c_int) -> c_int377     pub fn putchar(a: c_int) -> c_int;
fputs(a: *const c_char, f: *mut FILE) -> c_int378     pub fn fputs(a: *const c_char, f: *mut FILE) -> c_int;
puts(a: *const c_char) -> c_int379     pub fn puts(a: *const c_char) -> c_int;
perror(a: *const c_char)380     pub fn perror(a: *const c_char);
srand(a: c_uint)381     pub fn srand(a: c_uint);
atexit(a: extern "C" fn()) -> c_int382     pub fn atexit(a: extern "C" fn()) -> c_int;
at_quick_exit(a: extern "C" fn()) -> c_int383     pub fn at_quick_exit(a: extern "C" fn()) -> c_int;
quick_exit(a: c_int) -> !384     pub fn quick_exit(a: c_int) -> !;
posix_memalign(a: *mut *mut c_void, b: size_t, c: size_t) -> c_int385     pub fn posix_memalign(a: *mut *mut c_void, b: size_t, c: size_t) -> c_int;
rand_r(a: *mut c_uint) -> c_int386     pub fn rand_r(a: *mut c_uint) -> c_int;
random() -> c_long387     pub fn random() -> c_long;
srandom(a: c_uint)388     pub fn srandom(a: c_uint);
putenv(a: *mut c_char) -> c_int389     pub fn putenv(a: *mut c_char) -> c_int;
clock() -> clock_t390     pub fn clock() -> clock_t;
time(a: *mut time_t) -> time_t391     pub fn time(a: *mut time_t) -> time_t;
difftime(a: time_t, b: time_t) -> c_double392     pub fn difftime(a: time_t, b: time_t) -> c_double;
mktime(a: *mut tm) -> time_t393     pub fn mktime(a: *mut tm) -> time_t;
strftime( a: *mut c_char, b: size_t, c: *const c_char, d: *const tm, ) -> size_t394     pub fn strftime(
395         a: *mut c_char,
396         b: size_t,
397         c: *const c_char,
398         d: *const tm,
399     ) -> size_t;
gmtime(a: *const time_t) -> *mut tm400     pub fn gmtime(a: *const time_t) -> *mut tm;
gmtime_r(a: *const time_t, b: *mut tm) -> *mut tm401     pub fn gmtime_r(a: *const time_t, b: *mut tm) -> *mut tm;
localtime(a: *const time_t) -> *mut tm402     pub fn localtime(a: *const time_t) -> *mut tm;
localtime_r(a: *const time_t, b: *mut tm) -> *mut tm403     pub fn localtime_r(a: *const time_t, b: *mut tm) -> *mut tm;
asctime_r(a: *const tm, b: *mut c_char) -> *mut c_char404     pub fn asctime_r(a: *const tm, b: *mut c_char) -> *mut c_char;
ctime_r(a: *const time_t, b: *mut c_char) -> *mut c_char405     pub fn ctime_r(a: *const time_t, b: *mut c_char) -> *mut c_char;
406 
nanosleep(a: *const timespec, b: *mut timespec) -> c_int407     pub fn nanosleep(a: *const timespec, b: *mut timespec) -> c_int;
408     // pub fn clock_getres(a: clockid_t, b: *mut timespec) -> c_int;
409     // pub fn clock_gettime(a: clockid_t, b: *mut timespec) -> c_int;
410     // pub fn clock_nanosleep(
411     //     a: clockid_t,
412     //     a2: c_int,
413     //     b: *const timespec,
414     //     c: *mut timespec,
415     // ) -> c_int;
416 
isalnum(c: c_int) -> c_int417     pub fn isalnum(c: c_int) -> c_int;
isalpha(c: c_int) -> c_int418     pub fn isalpha(c: c_int) -> c_int;
iscntrl(c: c_int) -> c_int419     pub fn iscntrl(c: c_int) -> c_int;
isdigit(c: c_int) -> c_int420     pub fn isdigit(c: c_int) -> c_int;
isgraph(c: c_int) -> c_int421     pub fn isgraph(c: c_int) -> c_int;
islower(c: c_int) -> c_int422     pub fn islower(c: c_int) -> c_int;
isprint(c: c_int) -> c_int423     pub fn isprint(c: c_int) -> c_int;
ispunct(c: c_int) -> c_int424     pub fn ispunct(c: c_int) -> c_int;
isspace(c: c_int) -> c_int425     pub fn isspace(c: c_int) -> c_int;
isupper(c: c_int) -> c_int426     pub fn isupper(c: c_int) -> c_int;
isxdigit(c: c_int) -> c_int427     pub fn isxdigit(c: c_int) -> c_int;
isblank(c: c_int) -> c_int428     pub fn isblank(c: c_int) -> c_int;
tolower(c: c_int) -> c_int429     pub fn tolower(c: c_int) -> c_int;
toupper(c: c_int) -> c_int430     pub fn toupper(c: c_int) -> c_int;
setvbuf( stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t, ) -> c_int431     pub fn setvbuf(
432         stream: *mut FILE,
433         buffer: *mut c_char,
434         mode: c_int,
435         size: size_t,
436     ) -> c_int;
setbuf(stream: *mut FILE, buf: *mut c_char)437     pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char438     pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
439         -> *mut c_char;
atoi(s: *const c_char) -> c_int440     pub fn atoi(s: *const c_char) -> c_int;
atof(s: *const c_char) -> c_double441     pub fn atof(s: *const c_char) -> c_double;
strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double442     pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
strtol( s: *const c_char, endp: *mut *mut c_char, base: c_int, ) -> c_long443     pub fn strtol(
444         s: *const c_char,
445         endp: *mut *mut c_char,
446         base: c_int,
447     ) -> c_long;
strtoul( s: *const c_char, endp: *mut *mut c_char, base: c_int, ) -> c_ulong448     pub fn strtoul(
449         s: *const c_char,
450         endp: *mut *mut c_char,
451         base: c_int,
452     ) -> c_ulong;
453 
strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char454     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_char455     pub fn strncpy(
456         dst: *mut c_char,
457         src: *const c_char,
458         n: size_t,
459     ) -> *mut c_char;
strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char460     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_char461     pub fn strncat(
462         s: *mut c_char,
463         ct: *const c_char,
464         n: size_t,
465     ) -> *mut c_char;
strcmp(cs: *const c_char, ct: *const c_char) -> c_int466     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_int467     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_int468     pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
strchr(cs: *const c_char, c: c_int) -> *mut c_char469     pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
strrchr(cs: *const c_char, c: c_int) -> *mut c_char470     pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
strspn(cs: *const c_char, ct: *const c_char) -> size_t471     pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
strcspn(cs: *const c_char, ct: *const c_char) -> size_t472     pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
strdup(cs: *const c_char) -> *mut c_char473     pub fn strdup(cs: *const c_char) -> *mut c_char;
strndup(cs: *const c_char, n: size_t) -> *mut c_char474     pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char;
strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char475     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_char476     pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int477     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_int478     pub fn strncasecmp(
479         s1: *const c_char,
480         s2: *const c_char,
481         n: size_t,
482     ) -> c_int;
strlen(cs: *const c_char) -> size_t483     pub fn strlen(cs: *const c_char) -> size_t;
strnlen(cs: *const c_char, maxlen: size_t) -> size_t484     pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
strerror(n: c_int) -> *mut c_char485     pub fn strerror(n: c_int) -> *mut c_char;
strtok(s: *mut c_char, t: *const c_char) -> *mut c_char486     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_t487     pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
488 
memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void489     pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int490     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_void491     pub fn memcpy(
492         dest: *mut c_void,
493         src: *const c_void,
494         n: size_t,
495     ) -> *mut c_void;
memmove( dest: *mut c_void, src: *const c_void, n: size_t, ) -> *mut c_void496     pub fn memmove(
497         dest: *mut c_void,
498         src: *const c_void,
499         n: size_t,
500     ) -> *mut c_void;
memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void501     pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
502 
fprintf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int503     pub fn fprintf(
504         stream: *mut ::FILE,
505         format: *const ::c_char,
506         ...
507     ) -> ::c_int;
printf(format: *const ::c_char, ...) -> ::c_int508     pub fn printf(format: *const ::c_char, ...) -> ::c_int;
snprintf( s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ... ) -> ::c_int509     pub fn snprintf(
510         s: *mut ::c_char,
511         n: ::size_t,
512         format: *const ::c_char,
513         ...
514     ) -> ::c_int;
sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int515     pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
fscanf( stream: *mut ::FILE, format: *const ::c_char, ... ) -> ::c_int516     pub fn fscanf(
517         stream: *mut ::FILE,
518         format: *const ::c_char,
519         ...
520     ) -> ::c_int;
scanf(format: *const ::c_char, ...) -> ::c_int521     pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int522     pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
523         -> ::c_int;
getchar_unlocked() -> ::c_int524     pub fn getchar_unlocked() -> ::c_int;
putchar_unlocked(c: ::c_int) -> ::c_int525     pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
526 
shutdown(socket: ::c_int, how: ::c_int) -> ::c_int527     pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int528     pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
mkdir(path: *const c_char, mode: mode_t) -> ::c_int529     pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
stat(path: *const c_char, buf: *mut stat) -> ::c_int530     pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE531     pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
fileno(stream: *mut ::FILE) -> ::c_int532     pub fn fileno(stream: *mut ::FILE) -> ::c_int;
open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int533     pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
creat(path: *const c_char, mode: mode_t) -> ::c_int534     pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int535     pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
opendir(dirname: *const c_char) -> *mut ::DIR536     pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
fdopendir(fd: ::c_int) -> *mut ::DIR537     pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
readdir(dirp: *mut ::DIR) -> *mut ::dirent538     pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
closedir(dirp: *mut ::DIR) -> ::c_int539     pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
rewinddir(dirp: *mut ::DIR)540     pub fn rewinddir(dirp: *mut ::DIR);
dirfd(dirp: *mut ::DIR) -> ::c_int541     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
seekdir(dirp: *mut ::DIR, loc: ::c_long)542     pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
telldir(dirp: *mut ::DIR) -> ::c_long543     pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
544 
openat( dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ... ) -> ::c_int545     pub fn openat(
546         dirfd: ::c_int,
547         pathname: *const ::c_char,
548         flags: ::c_int,
549         ...
550     ) -> ::c_int;
fstatat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut stat, flags: ::c_int, ) -> ::c_int551     pub fn fstatat(
552         dirfd: ::c_int,
553         pathname: *const ::c_char,
554         buf: *mut stat,
555         flags: ::c_int,
556     ) -> ::c_int;
linkat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, flags: ::c_int, ) -> ::c_int557     pub fn linkat(
558         olddirfd: ::c_int,
559         oldpath: *const ::c_char,
560         newdirfd: ::c_int,
561         newpath: *const ::c_char,
562         flags: ::c_int,
563     ) -> ::c_int;
mkdirat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, ) -> ::c_int564     pub fn mkdirat(
565         dirfd: ::c_int,
566         pathname: *const ::c_char,
567         mode: ::mode_t,
568     ) -> ::c_int;
readlinkat( dirfd: ::c_int, pathname: *const ::c_char, buf: *mut ::c_char, bufsiz: ::size_t, ) -> ::ssize_t569     pub fn readlinkat(
570         dirfd: ::c_int,
571         pathname: *const ::c_char,
572         buf: *mut ::c_char,
573         bufsiz: ::size_t,
574     ) -> ::ssize_t;
renameat( olddirfd: ::c_int, oldpath: *const ::c_char, newdirfd: ::c_int, newpath: *const ::c_char, ) -> ::c_int575     pub fn renameat(
576         olddirfd: ::c_int,
577         oldpath: *const ::c_char,
578         newdirfd: ::c_int,
579         newpath: *const ::c_char,
580     ) -> ::c_int;
symlinkat( target: *const ::c_char, newdirfd: ::c_int, linkpath: *const ::c_char, ) -> ::c_int581     pub fn symlinkat(
582         target: *const ::c_char,
583         newdirfd: ::c_int,
584         linkpath: *const ::c_char,
585     ) -> ::c_int;
unlinkat( dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ) -> ::c_int586     pub fn unlinkat(
587         dirfd: ::c_int,
588         pathname: *const ::c_char,
589         flags: ::c_int,
590     ) -> ::c_int;
591 
access(path: *const c_char, amode: ::c_int) -> ::c_int592     pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
close(fd: ::c_int) -> ::c_int593     pub fn close(fd: ::c_int) -> ::c_int;
fpathconf(filedes: ::c_int, name: ::c_int) -> c_long594     pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
getopt( argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char, ) -> ::c_int595     pub fn getopt(
596         argc: ::c_int,
597         argv: *const *mut c_char,
598         optstr: *const c_char,
599     ) -> ::c_int;
isatty(fd: ::c_int) -> ::c_int600     pub fn isatty(fd: ::c_int) -> ::c_int;
link(src: *const c_char, dst: *const c_char) -> ::c_int601     pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t602     pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
pathconf(path: *const c_char, name: ::c_int) -> c_long603     pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
rmdir(path: *const c_char) -> ::c_int604     pub fn rmdir(path: *const c_char) -> ::c_int;
sleep(secs: ::c_uint) -> ::c_uint605     pub fn sleep(secs: ::c_uint) -> ::c_uint;
unlink(c: *const c_char) -> ::c_int606     pub fn unlink(c: *const c_char) -> ::c_int;
pread( fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t, ) -> ::ssize_t607     pub fn pread(
608         fd: ::c_int,
609         buf: *mut ::c_void,
610         count: ::size_t,
611         offset: off_t,
612     ) -> ::ssize_t;
pwrite( fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t, ) -> ::ssize_t613     pub fn pwrite(
614         fd: ::c_int,
615         buf: *const ::c_void,
616         count: ::size_t,
617         offset: off_t,
618     ) -> ::ssize_t;
619 
lstat(path: *const c_char, buf: *mut stat) -> ::c_int620     pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
621 
fsync(fd: ::c_int) -> ::c_int622     pub fn fsync(fd: ::c_int) -> ::c_int;
fdatasync(fd: ::c_int) -> ::c_int623     pub fn fdatasync(fd: ::c_int) -> ::c_int;
624 
symlink(path1: *const c_char, path2: *const c_char) -> ::c_int625     pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int;
626 
truncate(path: *const c_char, length: off_t) -> ::c_int627     pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
ftruncate(fd: ::c_int, length: off_t) -> ::c_int628     pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
629 
getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int630     pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
631 
gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int632     pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
times(buf: *mut ::tms) -> ::clock_t633     pub fn times(buf: *mut ::tms) -> ::clock_t;
634 
strerror_r( errnum: ::c_int, buf: *mut c_char, buflen: ::size_t, ) -> ::c_int635     pub fn strerror_r(
636         errnum: ::c_int,
637         buf: *mut c_char,
638         buflen: ::size_t,
639     ) -> ::c_int;
640 
usleep(secs: ::c_uint) -> ::c_int641     pub fn usleep(secs: ::c_uint) -> ::c_int;
send( socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int, ) -> ::ssize_t642     pub fn send(
643         socket: ::c_int,
644         buf: *const ::c_void,
645         len: ::size_t,
646         flags: ::c_int,
647     ) -> ::ssize_t;
recv( socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int, ) -> ::ssize_t648     pub fn recv(
649         socket: ::c_int,
650         buf: *mut ::c_void,
651         len: ::size_t,
652         flags: ::c_int,
653     ) -> ::ssize_t;
poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int654     pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
setlocale( category: ::c_int, locale: *const ::c_char, ) -> *mut ::c_char655     pub fn setlocale(
656         category: ::c_int,
657         locale: *const ::c_char,
658     ) -> *mut ::c_char;
localeconv() -> *mut lconv659     pub fn localeconv() -> *mut lconv;
660 
readlink( path: *const c_char, buf: *mut c_char, bufsz: ::size_t, ) -> ::ssize_t661     pub fn readlink(
662         path: *const c_char,
663         buf: *mut c_char,
664         bufsz: ::size_t,
665     ) -> ::ssize_t;
666 
timegm(tm: *mut ::tm) -> time_t667     pub fn timegm(tm: *mut ::tm) -> time_t;
668 
sysconf(name: ::c_int) -> ::c_long669     pub fn sysconf(name: ::c_int) -> ::c_long;
670 
ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int671     pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
672 
fseeko( stream: *mut ::FILE, offset: ::off_t, whence: ::c_int, ) -> ::c_int673     pub fn fseeko(
674         stream: *mut ::FILE,
675         offset: ::off_t,
676         whence: ::c_int,
677     ) -> ::c_int;
ftello(stream: *mut ::FILE) -> ::off_t678     pub fn ftello(stream: *mut ::FILE) -> ::off_t;
posix_fallocate( fd: ::c_int, offset: ::off_t, len: ::off_t, ) -> ::c_int679     pub fn posix_fallocate(
680         fd: ::c_int,
681         offset: ::off_t,
682         len: ::off_t,
683     ) -> ::c_int;
684 
strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char685     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_t686     pub fn getline(
687         lineptr: *mut *mut c_char,
688         n: *mut size_t,
689         stream: *mut FILE,
690     ) -> ssize_t;
691 
faccessat( dirfd: ::c_int, pathname: *const ::c_char, mode: ::c_int, flags: ::c_int, ) -> ::c_int692     pub fn faccessat(
693         dirfd: ::c_int,
694         pathname: *const ::c_char,
695         mode: ::c_int,
696         flags: ::c_int,
697     ) -> ::c_int;
writev( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, ) -> ::ssize_t698     pub fn writev(
699         fd: ::c_int,
700         iov: *const ::iovec,
701         iovcnt: ::c_int,
702     ) -> ::ssize_t;
readv( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, ) -> ::ssize_t703     pub fn readv(
704         fd: ::c_int,
705         iov: *const ::iovec,
706         iovcnt: ::c_int,
707     ) -> ::ssize_t;
pwritev( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t, ) -> ::ssize_t708     pub fn pwritev(
709         fd: ::c_int,
710         iov: *const ::iovec,
711         iovcnt: ::c_int,
712         offset: ::off_t,
713     ) -> ::ssize_t;
preadv( fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t, ) -> ::ssize_t714     pub fn preadv(
715         fd: ::c_int,
716         iov: *const ::iovec,
717         iovcnt: ::c_int,
718         offset: ::off_t,
719     ) -> ::ssize_t;
posix_fadvise( fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int, ) -> ::c_int720     pub fn posix_fadvise(
721         fd: ::c_int,
722         offset: ::off_t,
723         len: ::off_t,
724         advise: ::c_int,
725     ) -> ::c_int;
futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int726     pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
utimensat( dirfd: ::c_int, path: *const ::c_char, times: *const ::timespec, flag: ::c_int, ) -> ::c_int727     pub fn utimensat(
728         dirfd: ::c_int,
729         path: *const ::c_char,
730         times: *const ::timespec,
731         flag: ::c_int,
732     ) -> ::c_int;
getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int733     pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
memrchr( cx: *const ::c_void, c: ::c_int, n: ::size_t, ) -> *mut ::c_void734     pub fn memrchr(
735         cx: *const ::c_void,
736         c: ::c_int,
737         n: ::size_t,
738     ) -> *mut ::c_void;
abs(i: c_int) -> c_int739     pub fn abs(i: c_int) -> c_int;
labs(i: c_long) -> c_long740     pub fn labs(i: c_long) -> c_long;
duplocale(base: ::locale_t) -> ::locale_t741     pub fn duplocale(base: ::locale_t) -> ::locale_t;
freelocale(loc: ::locale_t)742     pub fn freelocale(loc: ::locale_t);
newlocale( mask: ::c_int, locale: *const ::c_char, base: ::locale_t, ) -> ::locale_t743     pub fn newlocale(
744         mask: ::c_int,
745         locale: *const ::c_char,
746         base: ::locale_t,
747     ) -> ::locale_t;
uselocale(loc: ::locale_t) -> ::locale_t748     pub fn uselocale(loc: ::locale_t) -> ::locale_t;
sched_yield() -> ::c_int749     pub fn sched_yield() -> ::c_int;
750 
__wasilibc_register_preopened_fd( fd: c_int, path: *const c_char, ) -> c_int751     pub fn __wasilibc_register_preopened_fd(
752         fd: c_int,
753         path: *const c_char,
754     ) -> c_int;
__wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int755     pub fn __wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int;
__wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int756     pub fn __wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int;
__wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int757     pub fn __wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int;
__wasilibc_find_relpath( path: *const c_char, relative_path: *mut *const c_char, ) -> c_int758     pub fn __wasilibc_find_relpath(
759         path: *const c_char,
760         relative_path: *mut *const c_char,
761     ) -> c_int;
__wasilibc_tell(fd: c_int) -> ::off_t762     pub fn __wasilibc_tell(fd: c_int) -> ::off_t;
763 
arc4random() -> u32764     pub fn arc4random() -> u32;
arc4random_buf(a: *mut c_void, b: size_t)765     pub fn arc4random_buf(a: *mut c_void, b: size_t);
arc4random_uniform(a: u32) -> u32766     pub fn arc4random_uniform(a: u32) -> u32;
767 }
768