| ... | @@ -1,21 +1,248 @@ | ... | @@ -1,21 +1,248 @@ |
| 1 | pub const clockid_t = u32; | 1 | // Based on https://github.com/CraneStation/wasi-sysroot/blob/wasi/libc-bottom-half/headers/public/wasi/core.h |
| 2 | pub const errno_t = u16; | 2 | // and https://github.com/WebAssembly/WASI/blob/master/design/WASI-core.md |
| 3 | pub const exitcode_t = u32; | 3 | |
| 4 | pub const fd_t = u32; | 4 | pub const advice_t = u8; |
| 5 | pub const signal_t = u8; | 5 | pub const ADVICE_NORMAL: advice_t = 0; |
| 6 | pub const timestamp_t = u64; | 6 | pub const ADVICE_SEQUENTIAL: advice_t = 1; |
| | 7 | pub const ADVICE_RANDOM: advice_t = 2; |
| | 8 | pub const ADVICE_WILLNEED: advice_t = 3; |
| | 9 | pub const ADVICE_DONTNEED: advice_t = 4; |
| | 10 | pub const ADVICE_NOREUSE: advice_t = 5; |
| 7 | | 11 | |
| 8 | pub const ciovec_t = extern struct { | 12 | pub const ciovec_t = extern struct { |
| 9 | buf: [*]const u8, | 13 | buf: [*]const u8, |
| 10 | buf_len: usize, | 14 | buf_len: usize, |
| 11 | }; | 15 | }; |
| 12 | | 16 | |
| | 17 | pub const clockid_t = u32; |
| 13 | pub const CLOCK_REALTIME: clockid_t = 0; | 18 | pub const CLOCK_REALTIME: clockid_t = 0; |
| 14 | pub const CLOCK_MONOTONIC: clockid_t = 1; | 19 | pub const CLOCK_MONOTONIC: clockid_t = 1; |
| 15 | pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; | 20 | pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; |
| 16 | pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3; | 21 | pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3; |
| 17 | | 22 | |
| | 23 | pub const device_t = u64; |
| | 24 | |
| | 25 | pub const dircookie_t = u64; |
| | 26 | pub const DIRCOOKIE_START: dircookie_t = 0; |
| | 27 | |
| | 28 | pub const errno_t = u16; |
| | 29 | pub const ESUCCESS: errno_t = 0; |
| | 30 | pub const E2BIG: errno_t = 1; |
| | 31 | pub const EACCES: errno_t = 2; |
| | 32 | pub const EADDRINUSE: errno_t = 3; |
| | 33 | pub const EADDRNOTAVAIL: errno_t = 4; |
| | 34 | pub const EAFNOSUPPORT: errno_t = 5; |
| | 35 | pub const EAGAIN: errno_t = 6; |
| | 36 | pub const EALREADY: errno_t = 7; |
| | 37 | pub const EBADF: errno_t = 8; |
| | 38 | pub const EBADMSG: errno_t = 9; |
| | 39 | pub const EBUSY: errno_t = 10; |
| | 40 | pub const ECANCELED: errno_t = 11; |
| | 41 | pub const ECHILD: errno_t = 12; |
| | 42 | pub const ECONNABORTED: errno_t = 13; |
| | 43 | pub const ECONNREFUSED: errno_t = 14; |
| | 44 | pub const ECONNRESET: errno_t = 15; |
| | 45 | pub const EDEADLK: errno_t = 16; |
| | 46 | pub const EDESTADDRREQ: errno_t = 17; |
| | 47 | pub const EDOM: errno_t = 18; |
| | 48 | pub const EDQUOT: errno_t = 19; |
| | 49 | pub const EEXIST: errno_t = 20; |
| | 50 | pub const EFAULT: errno_t = 21; |
| | 51 | pub const EFBIG: errno_t = 22; |
| | 52 | pub const EHOSTUNREACH: errno_t = 23; |
| | 53 | pub const EIDRM: errno_t = 24; |
| | 54 | pub const EILSEQ: errno_t = 25; |
| | 55 | pub const EINPROGRESS: errno_t = 26; |
| | 56 | pub const EINTR: errno_t = 27; |
| | 57 | pub const EINVAL: errno_t = 28; |
| | 58 | pub const EIO: errno_t = 29; |
| | 59 | pub const EISCONN: errno_t = 30; |
| | 60 | pub const EISDIR: errno_t = 31; |
| | 61 | pub const ELOOP: errno_t = 32; |
| | 62 | pub const EMFILE: errno_t = 33; |
| | 63 | pub const EMLINK: errno_t = 34; |
| | 64 | pub const EMSGSIZE: errno_t = 35; |
| | 65 | pub const EMULTIHOP: errno_t = 36; |
| | 66 | pub const ENAMETOOLONG: errno_t = 37; |
| | 67 | pub const ENETDOWN: errno_t = 38; |
| | 68 | pub const ENETRESET: errno_t = 39; |
| | 69 | pub const ENETUNREACH: errno_t = 40; |
| | 70 | pub const ENFILE: errno_t = 41; |
| | 71 | pub const ENOBUFS: errno_t = 42; |
| | 72 | pub const ENODEV: errno_t = 43; |
| | 73 | pub const ENOENT: errno_t = 44; |
| | 74 | pub const ENOEXEC: errno_t = 45; |
| | 75 | pub const ENOLCK: errno_t = 46; |
| | 76 | pub const ENOLINK: errno_t = 47; |
| | 77 | pub const ENOMEM: errno_t = 48; |
| | 78 | pub const ENOMSG: errno_t = 49; |
| | 79 | pub const ENOPROTOOPT: errno_t = 50; |
| | 80 | pub const ENOSPC: errno_t = 51; |
| | 81 | pub const ENOSYS: errno_t = 52; |
| | 82 | pub const ENOTCONN: errno_t = 53; |
| | 83 | pub const ENOTDIR: errno_t = 54; |
| | 84 | pub const ENOTEMPTY: errno_t = 55; |
| | 85 | pub const ENOTRECOVERABLE: errno_t = 56; |
| | 86 | pub const ENOTSOCK: errno_t = 57; |
| | 87 | pub const ENOTSUP: errno_t = 58; |
| | 88 | pub const ENOTTY: errno_t = 59; |
| | 89 | pub const ENXIO: errno_t = 60; |
| | 90 | pub const EOVERFLOW: errno_t = 61; |
| | 91 | pub const EOWNERDEAD: errno_t = 62; |
| | 92 | pub const EPERM: errno_t = 63; |
| | 93 | pub const EPIPE: errno_t = 64; |
| | 94 | pub const EPROTO: errno_t = 65; |
| | 95 | pub const EPROTONOSUPPORT: errno_t = 66; |
| | 96 | pub const EPROTOTYPE: errno_t = 67; |
| | 97 | pub const ERANGE: errno_t = 68; |
| | 98 | pub const EROFS: errno_t = 69; |
| | 99 | pub const ESPIPE: errno_t = 70; |
| | 100 | pub const ESRCH: errno_t = 71; |
| | 101 | pub const ESTALE: errno_t = 72; |
| | 102 | pub const ETIMEDOUT: errno_t = 73; |
| | 103 | pub const ETXTBSY: errno_t = 74; |
| | 104 | pub const EXDEV: errno_t = 75; |
| | 105 | pub const ENOTCAPABLE: errno_t = 76; |
| | 106 | |
| | 107 | pub const eventrwflags_t = u16; |
| | 108 | pub const EVENT_FD_READWRITE_HANGUP: eventrwflags_t = 0x0001; |
| | 109 | |
| | 110 | pub const eventtype_t = u8; |
| | 111 | pub const EVENTTYPE_CLOCK: eventtype_t = 0; |
| | 112 | pub const EVENTTYPE_FD_READ: eventtype_t = 1; |
| | 113 | pub const EVENTTYPE_FD_WRITE: eventtype_t = 2; |
| | 114 | |
| | 115 | pub const exitcode_t = u32; |
| | 116 | |
| | 117 | pub const fd_t = u32; |
| | 118 | |
| | 119 | pub const fdflags_t = u16; |
| | 120 | pub const FDFLAG_APPEND: fdflags_t = 0x0001; |
| | 121 | pub const FDFLAG_DSYNC: fdflags_t = 0x0002; |
| | 122 | pub const FDFLAG_NONBLOCK: fdflags_t = 0x0004; |
| | 123 | pub const FDFLAG_RSYNC: fdflags_t = 0x0008; |
| | 124 | pub const FDFLAG_SYNC: fdflags_t = 0x0010; |
| | 125 | |
| | 126 | pub const filedelta_t = i64; |
| | 127 | |
| | 128 | pub const filesize_t = u64; |
| | 129 | |
| | 130 | pub const filetype_t = u8; |
| | 131 | pub const FILETYPE_UNKNOWN: filetype_t = 0; |
| | 132 | pub const FILETYPE_BLOCK_DEVICE: filetype_t = 1; |
| | 133 | pub const FILETYPE_CHARACTER_DEVICE: filetype_t = 2; |
| | 134 | pub const FILETYPE_DIRECTORY: filetype_t = 3; |
| | 135 | pub const FILETYPE_REGULAR_FILE: filetype_t = 4; |
| | 136 | pub const FILETYPE_SOCKET_DGRAM: filetype_t = 5; |
| | 137 | pub const FILETYPE_SOCKET_STREAM: filetype_t = 6; |
| | 138 | pub const FILETYPE_SYMBOLIC_LINK: filetype_t = 7; |
| | 139 | |
| | 140 | pub const fstflags_t = u16; |
| | 141 | pub const FILESTAT_SET_ATIM: fstflags_t = 0x0001; |
| | 142 | pub const FILESTAT_SET_ATIM_NOW: fstflags_t = 0x0002; |
| | 143 | pub const FILESTAT_SET_MTIM: fstflags_t = 0x0004; |
| | 144 | pub const FILESTAT_SET_MTIM_NOW: fstflags_t = 0x0008; |
| | 145 | |
| | 146 | pub const inode_t = u64; |
| | 147 | |
| | 148 | pub const linkcount_t = u32; |
| | 149 | |
| | 150 | pub const lookupflags_t = u32; |
| | 151 | pub const LOOKUP_SYMLINK_FOLLOW: lookupflags_t = 0x00000001; |
| | 152 | |
| | 153 | pub const oflags_t = u16; |
| | 154 | pub const O_CREAT: oflags_t = 0x0001; |
| | 155 | pub const O_DIRECTORY: oflags_t = 0x0002; |
| | 156 | pub const O_EXCL: oflags_t = 0x0004; |
| | 157 | pub const O_TRUNC: oflags_t = 0x0008; |
| | 158 | |
| | 159 | pub const riflags_t = u16; |
| | 160 | pub const SOCK_RECV_PEEK: riflags_t = 0x0001; |
| | 161 | pub const SOCK_RECV_WAITALL: riflags_t = 0x0002; |
| | 162 | |
| | 163 | pub const rights_t = u64; |
| | 164 | pub const RIGHT_FD_DATASYNC: rights_t = 0x0000000000000001; |
| | 165 | pub const RIGHT_FD_READ: rights_t = 0x0000000000000002; |
| | 166 | pub const RIGHT_FD_SEEK: rights_t = 0x0000000000000004; |
| | 167 | pub const RIGHT_FD_FDSTAT_SET_FLAGS: rights_t = 0x0000000000000008; |
| | 168 | pub const RIGHT_FD_SYNC: rights_t = 0x0000000000000010; |
| | 169 | pub const RIGHT_FD_TELL: rights_t = 0x0000000000000020; |
| | 170 | pub const RIGHT_FD_WRITE: rights_t = 0x0000000000000040; |
| | 171 | pub const RIGHT_FD_ADVISE: rights_t = 0x0000000000000080; |
| | 172 | pub const RIGHT_FD_ALLOCATE: rights_t = 0x0000000000000100; |
| | 173 | pub const RIGHT_PATH_CREATE_DIRECTORY: rights_t = 0x0000000000000200; |
| | 174 | pub const RIGHT_PATH_CREATE_FILE: rights_t = 0x0000000000000400; |
| | 175 | pub const RIGHT_PATH_LINK_SOURCE: rights_t = 0x0000000000000800; |
| | 176 | pub const RIGHT_PATH_LINK_TARGET: rights_t = 0x0000000000001000; |
| | 177 | pub const RIGHT_PATH_OPEN: rights_t = 0x0000000000002000; |
| | 178 | pub const RIGHT_FD_READDIR: rights_t = 0x0000000000004000; |
| | 179 | pub const RIGHT_PATH_READLINK: rights_t = 0x0000000000008000; |
| | 180 | pub const RIGHT_PATH_RENAME_SOURCE: rights_t = 0x0000000000010000; |
| | 181 | pub const RIGHT_PATH_RENAME_TARGET: rights_t = 0x0000000000020000; |
| | 182 | pub const RIGHT_PATH_FILESTAT_GET: rights_t = 0x0000000000040000; |
| | 183 | pub const RIGHT_PATH_FILESTAT_SET_SIZE: rights_t = 0x0000000000080000; |
| | 184 | pub const RIGHT_PATH_FILESTAT_SET_TIMES: rights_t = 0x0000000000100000; |
| | 185 | pub const RIGHT_FD_FILESTAT_GET: rights_t = 0x0000000000200000; |
| | 186 | pub const RIGHT_FD_FILESTAT_SET_SIZE: rights_t = 0x0000000000400000; |
| | 187 | pub const RIGHT_FD_FILESTAT_SET_TIMES: rights_t = 0x0000000000800000; |
| | 188 | pub const RIGHT_PATH_SYMLINK: rights_t = 0x0000000001000000; |
| | 189 | pub const RIGHT_PATH_REMOVE_DIRECTORY: rights_t = 0x0000000002000000; |
| | 190 | pub const RIGHT_PATH_UNLINK_FILE: rights_t = 0x0000000004000000; |
| | 191 | pub const RIGHT_POLL_FD_READWRITE: rights_t = 0x0000000008000000; |
| | 192 | pub const RIGHT_SOCK_SHUTDOWN: rights_t = 0x0000000010000000; |
| | 193 | |
| | 194 | pub const roflags_t = u16; |
| | 195 | pub const SOCK_RECV_DATA_TRUNCATED: roflags_t = 0x0001; |
| | 196 | |
| | 197 | pub const sdflags_t = u8; |
| | 198 | pub const SHUT_RD: sdflags_t = 0x01; |
| | 199 | pub const SHUT_WR: sdflags_t = 0x02; |
| | 200 | |
| | 201 | pub const siflags_t = u16; |
| | 202 | |
| | 203 | pub const signal_t = u8; |
| | 204 | pub const SIGHUP: signal_t = 1; |
| | 205 | pub const SIGINT: signal_t = 2; |
| | 206 | pub const SIGQUIT: signal_t = 3; |
| | 207 | pub const SIGILL: signal_t = 4; |
| | 208 | pub const SIGTRAP: signal_t = 5; |
| 18 | pub const SIGABRT: signal_t = 6; | 209 | pub const SIGABRT: signal_t = 6; |
| | 210 | pub const SIGBUS: signal_t = 7; |
| | 211 | pub const SIGFPE: signal_t = 8; |
| | 212 | pub const SIGKILL: signal_t = 9; |
| | 213 | pub const SIGUSR1: signal_t = 10; |
| | 214 | pub const SIGSEGV: signal_t = 11; |
| | 215 | pub const SIGUSR2: signal_t = 12; |
| | 216 | pub const SIGPIPE: signal_t = 13; |
| | 217 | pub const SIGALRM: signal_t = 14; |
| | 218 | pub const SIGTERM: signal_t = 15; |
| | 219 | pub const SIGCHLD: signal_t = 16; |
| | 220 | pub const SIGCONT: signal_t = 17; |
| | 221 | pub const SIGSTOP: signal_t = 18; |
| | 222 | pub const SIGTSTP: signal_t = 19; |
| | 223 | pub const SIGTTIN: signal_t = 20; |
| | 224 | pub const SIGTTOU: signal_t = 21; |
| | 225 | pub const SIGURG: signal_t = 22; |
| | 226 | pub const SIGXCPU: signal_t = 23; |
| | 227 | pub const SIGXFSZ: signal_t = 24; |
| | 228 | pub const SIGVTALRM: signal_t = 25; |
| | 229 | pub const SIGPROF: signal_t = 26; |
| | 230 | pub const SIGWINCH: signal_t = 27; |
| | 231 | pub const SIGPOLL: signal_t = 28; |
| | 232 | pub const SIGPWR: signal_t = 29; |
| | 233 | pub const SIGSYS: signal_t = 30; |
| | 234 | |
| | 235 | pub const subclockflags_t = u16; |
| | 236 | pub const SUBSCRIPTION_CLOCK_ABSTIME: subclockflags_t = 0x0001; |
| | 237 | |
| | 238 | pub const timestamp_t = u64; |
| | 239 | |
| | 240 | pub const userdata_t = u64; |
| | 241 | |
| | 242 | pub const whence_t = u8; |
| | 243 | pub const WHENCE_CUR: whence_t = 0; |
| | 244 | pub const WHENCE_END: whence_t = 1; |
| | 245 | pub const WHENCE_SET: whence_t = 2; |
| 19 | | 246 | |
| 20 | pub extern "wasi_unstable" fn args_get(argv: [*][*]u8, argv_buf: [*]u8) errno_t; | 247 | pub extern "wasi_unstable" fn args_get(argv: [*][*]u8, argv_buf: [*]u8) errno_t; |
| 21 | pub extern "wasi_unstable" fn args_sizes_get(argc: *usize, argv_buf_size: *usize) errno_t; | 248 | pub extern "wasi_unstable" fn args_sizes_get(argc: *usize, argv_buf_size: *usize) errno_t; |