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