]>
Commit | Line | Data |
---|---|---|
e1599b0c XL |
1 | diff --git a/Cargo.toml b/Cargo.toml |
2 | index 47ecced..ec6e7c9 100644 | |
3 | --- a/Cargo.toml | |
4 | +++ b/Cargo.toml | |
5 | @@ -12,6 +12,7 @@ readme = "README.md" | |
6 | documentation = "https://docs.rs/wasi" | |
7 | ||
8 | [dependencies] | |
9 | +bitflags = "1.1.0" | |
10 | ||
11 | [badges] | |
12 | maintenance = { status = "experimental" } | |
13 | diff --git a/src/lib.rs b/src/lib.rs | |
14 | index 42e13ea..03d3d19 100644 | |
15 | --- a/src/lib.rs | |
16 | +++ b/src/lib.rs | |
17 | @@ -13,4 +13,7 @@ | |
18 | )] | |
19 | #![no_std] | |
20 | ||
21 | +#[macro_use] | |
22 | +extern crate bitflags; | |
23 | + | |
24 | pub mod wasi_unstable; | |
25 | diff --git a/src/wasi_unstable/mod.rs b/src/wasi_unstable/mod.rs | |
26 | index 4703cc9..b3fd897 100644 | |
27 | --- a/src/wasi_unstable/mod.rs | |
28 | +++ b/src/wasi_unstable/mod.rs | |
29 | @@ -19,27 +19,18 @@ pub type Clockid = __wasi_clockid_t; | |
30 | pub type Device = __wasi_device_t; | |
31 | pub type Dircookie = __wasi_dircookie_t; | |
32 | pub type Errno = __wasi_errno_t; | |
33 | -pub type Eventrwflags = __wasi_eventrwflags_t; | |
34 | pub type Eventtype = __wasi_eventtype_t; | |
35 | pub type Exitcode = __wasi_exitcode_t; | |
36 | pub type Fd = __wasi_fd_t; | |
37 | -pub type Fdflags = __wasi_fdflags_t; | |
38 | pub type Filedelta = __wasi_filedelta_t; | |
39 | pub type Filesize = __wasi_filesize_t; | |
40 | pub type Filetype = __wasi_filetype_t; | |
41 | -pub type Fstflags = __wasi_fstflags_t; | |
42 | pub type Inode = __wasi_inode_t; | |
43 | pub type Linkcount = __wasi_linkcount_t; | |
44 | -pub type Lookupflags = __wasi_lookupflags_t; | |
45 | -pub type Oflags = __wasi_oflags_t; | |
46 | pub type Preopentype = __wasi_preopentype_t; | |
47 | -pub type Riflags = __wasi_riflags_t; | |
48 | -pub type Rights = __wasi_rights_t; | |
49 | pub type Roflags = __wasi_roflags_t; | |
50 | -pub type Sdflags = __wasi_sdflags_t; | |
51 | pub type Siflags = __wasi_siflags_t; | |
52 | pub type Signal = __wasi_signal_t; | |
53 | -pub type Subclockflags = __wasi_subclockflags_t; | |
54 | pub type Timestamp = __wasi_timestamp_t; | |
55 | pub type Userdata = __wasi_userdata_t; | |
56 | pub type Whence = __wasi_whence_t; | |
57 | @@ -52,189 +43,231 @@ pub type Subscription = __wasi_subscription_t; | |
58 | pub type Event = __wasi_event_t; | |
59 | pub type Prestat = __wasi_prestat_t; | |
60 | ||
61 | -pub const ADVICE_NORMAL: u8 = __WASI_ADVICE_NORMAL; | |
62 | -pub const ADVICE_SEQUENTIAL: u8 = __WASI_ADVICE_SEQUENTIAL; | |
63 | -pub const ADVICE_RANDOM: u8 = __WASI_ADVICE_RANDOM; | |
64 | -pub const ADVICE_WILLNEED: u8 = __WASI_ADVICE_WILLNEED; | |
65 | -pub const ADVICE_DONTNEED: u8 = __WASI_ADVICE_DONTNEED; | |
66 | -pub const ADVICE_NOREUSE: u8 = __WASI_ADVICE_NOREUSE; | |
67 | -pub const CLOCK_REALTIME: u32 = __WASI_CLOCK_REALTIME; | |
68 | -pub const CLOCK_MONOTONIC: u32 = __WASI_CLOCK_MONOTONIC; | |
69 | -pub const CLOCK_PROCESS_CPUTIME_ID: u32 = __WASI_CLOCK_PROCESS_CPUTIME_ID; | |
70 | -pub const CLOCK_THREAD_CPUTIME_ID: u32 = __WASI_CLOCK_THREAD_CPUTIME_ID; | |
71 | -pub const DIRCOOKIE_START: u64 = __WASI_DIRCOOKIE_START; | |
72 | -pub const ESUCCESS: u16 = __WASI_ESUCCESS; | |
73 | -pub const E2BIG: u16 = __WASI_E2BIG; | |
74 | -pub const EACCES: u16 = __WASI_EACCES; | |
75 | -pub const EADDRINUSE: u16 = __WASI_EADDRINUSE; | |
76 | -pub const EADDRNOTAVAIL: u16 = __WASI_EADDRNOTAVAIL; | |
77 | -pub const EAFNOSUPPORT: u16 = __WASI_EAFNOSUPPORT; | |
78 | -pub const EAGAIN: u16 = __WASI_EAGAIN; | |
79 | -pub const EALREADY: u16 = __WASI_EALREADY; | |
80 | -pub const EBADF: u16 = __WASI_EBADF; | |
81 | -pub const EBADMSG: u16 = __WASI_EBADMSG; | |
82 | -pub const EBUSY: u16 = __WASI_EBUSY; | |
83 | -pub const ECANCELED: u16 = __WASI_ECANCELED; | |
84 | -pub const ECHILD: u16 = __WASI_ECHILD; | |
85 | -pub const ECONNABORTED: u16 = __WASI_ECONNABORTED; | |
86 | -pub const ECONNREFUSED: u16 = __WASI_ECONNREFUSED; | |
87 | -pub const ECONNRESET: u16 = __WASI_ECONNRESET; | |
88 | -pub const EDEADLK: u16 = __WASI_EDEADLK; | |
89 | -pub const EDESTADDRREQ: u16 = __WASI_EDESTADDRREQ; | |
90 | -pub const EDOM: u16 = __WASI_EDOM; | |
91 | -pub const EDQUOT: u16 = __WASI_EDQUOT; | |
92 | -pub const EEXIST: u16 = __WASI_EEXIST; | |
93 | -pub const EFAULT: u16 = __WASI_EFAULT; | |
94 | -pub const EFBIG: u16 = __WASI_EFBIG; | |
95 | -pub const EHOSTUNREACH: u16 = __WASI_EHOSTUNREACH; | |
96 | -pub const EIDRM: u16 = __WASI_EIDRM; | |
97 | -pub const EILSEQ: u16 = __WASI_EILSEQ; | |
98 | -pub const EINPROGRESS: u16 = __WASI_EINPROGRESS; | |
99 | -pub const EINTR: u16 = __WASI_EINTR; | |
100 | -pub const EINVAL: u16 = __WASI_EINVAL; | |
101 | -pub const EIO: u16 = __WASI_EIO; | |
102 | -pub const EISCONN: u16 = __WASI_EISCONN; | |
103 | -pub const EISDIR: u16 = __WASI_EISDIR; | |
104 | -pub const ELOOP: u16 = __WASI_ELOOP; | |
105 | -pub const EMFILE: u16 = __WASI_EMFILE; | |
106 | -pub const EMLINK: u16 = __WASI_EMLINK; | |
107 | -pub const EMSGSIZE: u16 = __WASI_EMSGSIZE; | |
108 | -pub const EMULTIHOP: u16 = __WASI_EMULTIHOP; | |
109 | -pub const ENAMETOOLONG: u16 = __WASI_ENAMETOOLONG; | |
110 | -pub const ENETDOWN: u16 = __WASI_ENETDOWN; | |
111 | -pub const ENETRESET: u16 = __WASI_ENETRESET; | |
112 | -pub const ENETUNREACH: u16 = __WASI_ENETUNREACH; | |
113 | -pub const ENFILE: u16 = __WASI_ENFILE; | |
114 | -pub const ENOBUFS: u16 = __WASI_ENOBUFS; | |
115 | -pub const ENODEV: u16 = __WASI_ENODEV; | |
116 | -pub const ENOENT: u16 = __WASI_ENOENT; | |
117 | -pub const ENOEXEC: u16 = __WASI_ENOEXEC; | |
118 | -pub const ENOLCK: u16 = __WASI_ENOLCK; | |
119 | -pub const ENOLINK: u16 = __WASI_ENOLINK; | |
120 | -pub const ENOMEM: u16 = __WASI_ENOMEM; | |
121 | -pub const ENOMSG: u16 = __WASI_ENOMSG; | |
122 | -pub const ENOPROTOOPT: u16 = __WASI_ENOPROTOOPT; | |
123 | -pub const ENOSPC: u16 = __WASI_ENOSPC; | |
124 | -pub const ENOSYS: u16 = __WASI_ENOSYS; | |
125 | -pub const ENOTCONN: u16 = __WASI_ENOTCONN; | |
126 | -pub const ENOTDIR: u16 = __WASI_ENOTDIR; | |
127 | -pub const ENOTEMPTY: u16 = __WASI_ENOTEMPTY; | |
128 | -pub const ENOTRECOVERABLE: u16 = __WASI_ENOTRECOVERABLE; | |
129 | -pub const ENOTSOCK: u16 = __WASI_ENOTSOCK; | |
130 | -pub const ENOTSUP: u16 = __WASI_ENOTSUP; | |
131 | -pub const ENOTTY: u16 = __WASI_ENOTTY; | |
132 | -pub const ENXIO: u16 = __WASI_ENXIO; | |
133 | -pub const EOVERFLOW: u16 = __WASI_EOVERFLOW; | |
134 | -pub const EOWNERDEAD: u16 = __WASI_EOWNERDEAD; | |
135 | -pub const EPERM: u16 = __WASI_EPERM; | |
136 | -pub const EPIPE: u16 = __WASI_EPIPE; | |
137 | -pub const EPROTO: u16 = __WASI_EPROTO; | |
138 | -pub const EPROTONOSUPPORT: u16 = __WASI_EPROTONOSUPPORT; | |
139 | -pub const EPROTOTYPE: u16 = __WASI_EPROTOTYPE; | |
140 | -pub const ERANGE: u16 = __WASI_ERANGE; | |
141 | -pub const EROFS: u16 = __WASI_EROFS; | |
142 | -pub const ESPIPE: u16 = __WASI_ESPIPE; | |
143 | -pub const ESRCH: u16 = __WASI_ESRCH; | |
144 | -pub const ESTALE: u16 = __WASI_ESTALE; | |
145 | -pub const ETIMEDOUT: u16 = __WASI_ETIMEDOUT; | |
146 | -pub const ETXTBSY: u16 = __WASI_ETXTBSY; | |
147 | -pub const EXDEV: u16 = __WASI_EXDEV; | |
148 | -pub const ENOTCAPABLE: u16 = __WASI_ENOTCAPABLE; | |
149 | -pub const EVENT_FD_READWRITE_HANGUP: u16 = __WASI_EVENT_FD_READWRITE_HANGUP; | |
150 | -pub const EVENTTYPE_CLOCK: u8 = __WASI_EVENTTYPE_CLOCK; | |
151 | -pub const EVENTTYPE_FD_READ: u8 = __WASI_EVENTTYPE_FD_READ; | |
152 | -pub const EVENTTYPE_FD_WRITE: u8 = __WASI_EVENTTYPE_FD_WRITE; | |
153 | -pub const FDFLAG_APPEND: u16 = __WASI_FDFLAG_APPEND; | |
154 | -pub const FDFLAG_DSYNC: u16 = __WASI_FDFLAG_DSYNC; | |
155 | -pub const FDFLAG_NONBLOCK: u16 = __WASI_FDFLAG_NONBLOCK; | |
156 | -pub const FDFLAG_RSYNC: u16 = __WASI_FDFLAG_RSYNC; | |
157 | -pub const FDFLAG_SYNC: u16 = __WASI_FDFLAG_SYNC; | |
158 | -pub const FILETYPE_UNKNOWN: u8 = __WASI_FILETYPE_UNKNOWN; | |
159 | -pub const FILETYPE_BLOCK_DEVICE: u8 = __WASI_FILETYPE_BLOCK_DEVICE; | |
160 | -pub const FILETYPE_CHARACTER_DEVICE: u8 = __WASI_FILETYPE_CHARACTER_DEVICE; | |
161 | -pub const FILETYPE_DIRECTORY: u8 = __WASI_FILETYPE_DIRECTORY; | |
162 | -pub const FILETYPE_REGULAR_FILE: u8 = __WASI_FILETYPE_REGULAR_FILE; | |
163 | -pub const FILETYPE_SOCKET_DGRAM: u8 = __WASI_FILETYPE_SOCKET_DGRAM; | |
164 | -pub const FILETYPE_SOCKET_STREAM: u8 = __WASI_FILETYPE_SOCKET_STREAM; | |
165 | -pub const FILETYPE_SYMBOLIC_LINK: u8 = __WASI_FILETYPE_SYMBOLIC_LINK; | |
166 | -pub const FILESTAT_SET_ATIM: u16 = __WASI_FILESTAT_SET_ATIM; | |
167 | -pub const FILESTAT_SET_ATIM_NOW: u16 = __WASI_FILESTAT_SET_ATIM_NOW; | |
168 | -pub const FILESTAT_SET_MTIM: u16 = __WASI_FILESTAT_SET_MTIM; | |
169 | -pub const FILESTAT_SET_MTIM_NOW: u16 = __WASI_FILESTAT_SET_MTIM_NOW; | |
170 | -pub const LOOKUP_SYMLINK_FOLLOW: u32 = __WASI_LOOKUP_SYMLINK_FOLLOW; | |
171 | -pub const O_CREAT: u16 = __WASI_O_CREAT; | |
172 | -pub const O_DIRECTORY: u16 = __WASI_O_DIRECTORY; | |
173 | -pub const O_EXCL: u16 = __WASI_O_EXCL; | |
174 | -pub const O_TRUNC: u16 = __WASI_O_TRUNC; | |
175 | -pub const PREOPENTYPE_DIR: u8 = __WASI_PREOPENTYPE_DIR; | |
176 | -pub const SOCK_RECV_PEEK: u16 = __WASI_SOCK_RECV_PEEK; | |
177 | -pub const SOCK_RECV_WAITALL: u16 = __WASI_SOCK_RECV_WAITALL; | |
178 | -pub const RIGHT_FD_DATASYNC: u64 = __WASI_RIGHT_FD_DATASYNC; | |
179 | -pub const RIGHT_FD_READ: u64 = __WASI_RIGHT_FD_READ; | |
180 | -pub const RIGHT_FD_SEEK: u64 = __WASI_RIGHT_FD_SEEK; | |
181 | -pub const RIGHT_FD_FDSTAT_SET_FLAGS: u64 = __WASI_RIGHT_FD_FDSTAT_SET_FLAGS; | |
182 | -pub const RIGHT_FD_SYNC: u64 = __WASI_RIGHT_FD_SYNC; | |
183 | -pub const RIGHT_FD_TELL: u64 = __WASI_RIGHT_FD_TELL; | |
184 | -pub const RIGHT_FD_WRITE: u64 = __WASI_RIGHT_FD_WRITE; | |
185 | -pub const RIGHT_FD_ADVISE: u64 = __WASI_RIGHT_FD_ADVISE; | |
186 | -pub const RIGHT_FD_ALLOCATE: u64 = __WASI_RIGHT_FD_ALLOCATE; | |
187 | -pub const RIGHT_PATH_CREATE_DIRECTORY: u64 = __WASI_RIGHT_PATH_CREATE_DIRECTORY; | |
188 | -pub const RIGHT_PATH_CREATE_FILE: u64 = __WASI_RIGHT_PATH_CREATE_FILE; | |
189 | -pub const RIGHT_PATH_LINK_SOURCE: u64 = __WASI_RIGHT_PATH_LINK_SOURCE; | |
190 | -pub const RIGHT_PATH_LINK_TARGET: u64 = __WASI_RIGHT_PATH_LINK_TARGET; | |
191 | -pub const RIGHT_PATH_OPEN: u64 = __WASI_RIGHT_PATH_OPEN; | |
192 | -pub const RIGHT_FD_READDIR: u64 = __WASI_RIGHT_FD_READDIR; | |
193 | -pub const RIGHT_PATH_READLINK: u64 = __WASI_RIGHT_PATH_READLINK; | |
194 | -pub const RIGHT_PATH_RENAME_SOURCE: u64 = __WASI_RIGHT_PATH_RENAME_SOURCE; | |
195 | -pub const RIGHT_PATH_RENAME_TARGET: u64 = __WASI_RIGHT_PATH_RENAME_TARGET; | |
196 | -pub const RIGHT_PATH_FILESTAT_GET: u64 = __WASI_RIGHT_PATH_FILESTAT_GET; | |
197 | -pub const RIGHT_PATH_FILESTAT_SET_SIZE: u64 = __WASI_RIGHT_PATH_FILESTAT_SET_SIZE; | |
198 | -pub const RIGHT_PATH_FILESTAT_SET_TIMES: u64 = __WASI_RIGHT_PATH_FILESTAT_SET_TIMES; | |
199 | -pub const RIGHT_FD_FILESTAT_GET: u64 = __WASI_RIGHT_FD_FILESTAT_GET; | |
200 | -pub const RIGHT_FD_FILESTAT_SET_SIZE: u64 = __WASI_RIGHT_FD_FILESTAT_SET_SIZE; | |
201 | -pub const RIGHT_FD_FILESTAT_SET_TIMES: u64 = __WASI_RIGHT_FD_FILESTAT_SET_TIMES; | |
202 | -pub const RIGHT_PATH_SYMLINK: u64 = __WASI_RIGHT_PATH_SYMLINK; | |
203 | -pub const RIGHT_PATH_REMOVE_DIRECTORY: u64 = __WASI_RIGHT_PATH_REMOVE_DIRECTORY; | |
204 | -pub const RIGHT_PATH_UNLINK_FILE: u64 = __WASI_RIGHT_PATH_UNLINK_FILE; | |
205 | -pub const RIGHT_POLL_FD_READWRITE: u64 = __WASI_RIGHT_POLL_FD_READWRITE; | |
206 | -pub const RIGHT_SOCK_SHUTDOWN: u64 = __WASI_RIGHT_SOCK_SHUTDOWN; | |
207 | -pub const SOCK_RECV_DATA_TRUNCATED: u16 = __WASI_SOCK_RECV_DATA_TRUNCATED; | |
208 | -pub const SHUT_RD: u8 = __WASI_SHUT_RD; | |
209 | -pub const SHUT_WR: u8 = __WASI_SHUT_WR; | |
210 | -pub const SIGHUP: u8 = __WASI_SIGHUP; | |
211 | -pub const SIGINT: u8 = __WASI_SIGINT; | |
212 | -pub const SIGQUIT: u8 = __WASI_SIGQUIT; | |
213 | -pub const SIGILL: u8 = __WASI_SIGILL; | |
214 | -pub const SIGTRAP: u8 = __WASI_SIGTRAP; | |
215 | -pub const SIGABRT: u8 = __WASI_SIGABRT; | |
216 | -pub const SIGBUS: u8 = __WASI_SIGBUS; | |
217 | -pub const SIGFPE: u8 = __WASI_SIGFPE; | |
218 | -pub const SIGKILL: u8 = __WASI_SIGKILL; | |
219 | -pub const SIGUSR1: u8 = __WASI_SIGUSR1; | |
220 | -pub const SIGSEGV: u8 = __WASI_SIGSEGV; | |
221 | -pub const SIGUSR2: u8 = __WASI_SIGUSR2; | |
222 | -pub const SIGPIPE: u8 = __WASI_SIGPIPE; | |
223 | -pub const SIGALRM: u8 = __WASI_SIGALRM; | |
224 | -pub const SIGTERM: u8 = __WASI_SIGTERM; | |
225 | -pub const SIGCHLD: u8 = __WASI_SIGCHLD; | |
226 | -pub const SIGCONT: u8 = __WASI_SIGCONT; | |
227 | -pub const SIGSTOP: u8 = __WASI_SIGSTOP; | |
228 | -pub const SIGTSTP: u8 = __WASI_SIGTSTP; | |
229 | -pub const SIGTTIN: u8 = __WASI_SIGTTIN; | |
230 | -pub const SIGTTOU: u8 = __WASI_SIGTTOU; | |
231 | -pub const SIGURG: u8 = __WASI_SIGURG; | |
232 | -pub const SIGXCPU: u8 = __WASI_SIGXCPU; | |
233 | -pub const SIGXFSZ: u8 = __WASI_SIGXFSZ; | |
234 | -pub const SIGVTALRM: u8 = __WASI_SIGVTALRM; | |
235 | -pub const SIGPROF: u8 = __WASI_SIGPROF; | |
236 | -pub const SIGWINCH: u8 = __WASI_SIGWINCH; | |
237 | -pub const SIGPOLL: u8 = __WASI_SIGPOLL; | |
238 | -pub const SIGPWR: u8 = __WASI_SIGPWR; | |
239 | -pub const SIGSYS: u8 = __WASI_SIGSYS; | |
240 | -pub const SUBSCRIPTION_CLOCK_ABSTIME: u16 = __WASI_SUBSCRIPTION_CLOCK_ABSTIME; | |
241 | -pub const WHENCE_CUR: u8 = __WASI_WHENCE_CUR; | |
242 | -pub const WHENCE_END: u8 = __WASI_WHENCE_END; | |
243 | -pub const WHENCE_SET: u8 = __WASI_WHENCE_SET; | |
244 | +pub const ADVICE_NORMAL: Advice = __WASI_ADVICE_NORMAL; | |
245 | +pub const ADVICE_SEQUENTIAL: Advice = __WASI_ADVICE_SEQUENTIAL; | |
246 | +pub const ADVICE_RANDOM: Advice = __WASI_ADVICE_RANDOM; | |
247 | +pub const ADVICE_WILLNEED: Advice = __WASI_ADVICE_WILLNEED; | |
248 | +pub const ADVICE_DONTNEED: Advice = __WASI_ADVICE_DONTNEED; | |
249 | +pub const ADVICE_NOREUSE: Advice = __WASI_ADVICE_NOREUSE; | |
250 | +pub const CLOCK_REALTIME: Clockid = __WASI_CLOCK_REALTIME; | |
251 | +pub const CLOCK_MONOTONIC: Clockid = __WASI_CLOCK_MONOTONIC; | |
252 | +pub const CLOCK_PROCESS_CPUTIME_ID: Clockid = __WASI_CLOCK_PROCESS_CPUTIME_ID; | |
253 | +pub const CLOCK_THREAD_CPUTIME_ID: Clockid = __WASI_CLOCK_THREAD_CPUTIME_ID; | |
254 | +pub const DIRCOOKIE_START: Dircookie = __WASI_DIRCOOKIE_START; | |
255 | +pub const ESUCCESS: Errno = __WASI_ESUCCESS; | |
256 | +pub const E2BIG: Errno = __WASI_E2BIG; | |
257 | +pub const EACCES: Errno = __WASI_EACCES; | |
258 | +pub const EADDRINUSE: Errno = __WASI_EADDRINUSE; | |
259 | +pub const EADDRNOTAVAIL: Errno = __WASI_EADDRNOTAVAIL; | |
260 | +pub const EAFNOSUPPORT: Errno = __WASI_EAFNOSUPPORT; | |
261 | +pub const EAGAIN: Errno = __WASI_EAGAIN; | |
262 | +pub const EALREADY: Errno = __WASI_EALREADY; | |
263 | +pub const EBADF: Errno = __WASI_EBADF; | |
264 | +pub const EBADMSG: Errno = __WASI_EBADMSG; | |
265 | +pub const EBUSY: Errno = __WASI_EBUSY; | |
266 | +pub const ECANCELED: Errno = __WASI_ECANCELED; | |
267 | +pub const ECHILD: Errno = __WASI_ECHILD; | |
268 | +pub const ECONNABORTED: Errno = __WASI_ECONNABORTED; | |
269 | +pub const ECONNREFUSED: Errno = __WASI_ECONNREFUSED; | |
270 | +pub const ECONNRESET: Errno = __WASI_ECONNRESET; | |
271 | +pub const EDEADLK: Errno = __WASI_EDEADLK; | |
272 | +pub const EDESTADDRREQ: Errno = __WASI_EDESTADDRREQ; | |
273 | +pub const EDOM: Errno = __WASI_EDOM; | |
274 | +pub const EDQUOT: Errno = __WASI_EDQUOT; | |
275 | +pub const EEXIST: Errno = __WASI_EEXIST; | |
276 | +pub const EFAULT: Errno = __WASI_EFAULT; | |
277 | +pub const EFBIG: Errno = __WASI_EFBIG; | |
278 | +pub const EHOSTUNREACH: Errno = __WASI_EHOSTUNREACH; | |
279 | +pub const EIDRM: Errno = __WASI_EIDRM; | |
280 | +pub const EILSEQ: Errno = __WASI_EILSEQ; | |
281 | +pub const EINPROGRESS: Errno = __WASI_EINPROGRESS; | |
282 | +pub const EINTR: Errno = __WASI_EINTR; | |
283 | +pub const EINVAL: Errno = __WASI_EINVAL; | |
284 | +pub const EIO: Errno = __WASI_EIO; | |
285 | +pub const EISCONN: Errno = __WASI_EISCONN; | |
286 | +pub const EISDIR: Errno = __WASI_EISDIR; | |
287 | +pub const ELOOP: Errno = __WASI_ELOOP; | |
288 | +pub const EMFILE: Errno = __WASI_EMFILE; | |
289 | +pub const EMLINK: Errno = __WASI_EMLINK; | |
290 | +pub const EMSGSIZE: Errno = __WASI_EMSGSIZE; | |
291 | +pub const EMULTIHOP: Errno = __WASI_EMULTIHOP; | |
292 | +pub const ENAMETOOLONG: Errno = __WASI_ENAMETOOLONG; | |
293 | +pub const ENETDOWN: Errno = __WASI_ENETDOWN; | |
294 | +pub const ENETRESET: Errno = __WASI_ENETRESET; | |
295 | +pub const ENETUNREACH: Errno = __WASI_ENETUNREACH; | |
296 | +pub const ENFILE: Errno = __WASI_ENFILE; | |
297 | +pub const ENOBUFS: Errno = __WASI_ENOBUFS; | |
298 | +pub const ENODEV: Errno = __WASI_ENODEV; | |
299 | +pub const ENOENT: Errno = __WASI_ENOENT; | |
300 | +pub const ENOEXEC: Errno = __WASI_ENOEXEC; | |
301 | +pub const ENOLCK: Errno = __WASI_ENOLCK; | |
302 | +pub const ENOLINK: Errno = __WASI_ENOLINK; | |
303 | +pub const ENOMEM: Errno = __WASI_ENOMEM; | |
304 | +pub const ENOMSG: Errno = __WASI_ENOMSG; | |
305 | +pub const ENOPROTOOPT: Errno = __WASI_ENOPROTOOPT; | |
306 | +pub const ENOSPC: Errno = __WASI_ENOSPC; | |
307 | +pub const ENOSYS: Errno = __WASI_ENOSYS; | |
308 | +pub const ENOTCONN: Errno = __WASI_ENOTCONN; | |
309 | +pub const ENOTDIR: Errno = __WASI_ENOTDIR; | |
310 | +pub const ENOTEMPTY: Errno = __WASI_ENOTEMPTY; | |
311 | +pub const ENOTRECOVERABLE: Errno = __WASI_ENOTRECOVERABLE; | |
312 | +pub const ENOTSOCK: Errno = __WASI_ENOTSOCK; | |
313 | +pub const ENOTSUP: Errno = __WASI_ENOTSUP; | |
314 | +pub const ENOTTY: Errno = __WASI_ENOTTY; | |
315 | +pub const ENXIO: Errno = __WASI_ENXIO; | |
316 | +pub const EOVERFLOW: Errno = __WASI_EOVERFLOW; | |
317 | +pub const EOWNERDEAD: Errno = __WASI_EOWNERDEAD; | |
318 | +pub const EPERM: Errno = __WASI_EPERM; | |
319 | +pub const EPIPE: Errno = __WASI_EPIPE; | |
320 | +pub const EPROTO: Errno = __WASI_EPROTO; | |
321 | +pub const EPROTONOSUPPORT: Errno = __WASI_EPROTONOSUPPORT; | |
322 | +pub const EPROTOTYPE: Errno = __WASI_EPROTOTYPE; | |
323 | +pub const ERANGE: Errno = __WASI_ERANGE; | |
324 | +pub const EROFS: Errno = __WASI_EROFS; | |
325 | +pub const ESPIPE: Errno = __WASI_ESPIPE; | |
326 | +pub const ESRCH: Errno = __WASI_ESRCH; | |
327 | +pub const ESTALE: Errno = __WASI_ESTALE; | |
328 | +pub const ETIMEDOUT: Errno = __WASI_ETIMEDOUT; | |
329 | +pub const ETXTBSY: Errno = __WASI_ETXTBSY; | |
330 | +pub const EXDEV: Errno = __WASI_EXDEV; | |
331 | +pub const ENOTCAPABLE: Errno = __WASI_ENOTCAPABLE; | |
332 | +pub const EVENTTYPE_CLOCK: Eventtype = __WASI_EVENTTYPE_CLOCK; | |
333 | +pub const EVENTTYPE_FD_READ: Eventtype = __WASI_EVENTTYPE_FD_READ; | |
334 | +pub const EVENTTYPE_FD_WRITE: Eventtype = __WASI_EVENTTYPE_FD_WRITE; | |
335 | +pub const FILETYPE_UNKNOWN: Filetype = __WASI_FILETYPE_UNKNOWN; | |
336 | +pub const FILETYPE_BLOCK_DEVICE: Filetype = __WASI_FILETYPE_BLOCK_DEVICE; | |
337 | +pub const FILETYPE_CHARACTER_DEVICE: Filetype = __WASI_FILETYPE_CHARACTER_DEVICE; | |
338 | +pub const FILETYPE_DIRECTORY: Filetype = __WASI_FILETYPE_DIRECTORY; | |
339 | +pub const FILETYPE_REGULAR_FILE: Filetype = __WASI_FILETYPE_REGULAR_FILE; | |
340 | +pub const FILETYPE_SOCKET_DGRAM: Filetype = __WASI_FILETYPE_SOCKET_DGRAM; | |
341 | +pub const FILETYPE_SOCKET_STREAM: Filetype = __WASI_FILETYPE_SOCKET_STREAM; | |
342 | +pub const FILETYPE_SYMBOLIC_LINK: Filetype = __WASI_FILETYPE_SYMBOLIC_LINK; | |
343 | +pub const PREOPENTYPE_DIR: Preopentype = __WASI_PREOPENTYPE_DIR; | |
344 | +pub const SIGHUP: Signal = __WASI_SIGHUP; | |
345 | +pub const SIGINT: Signal = __WASI_SIGINT; | |
346 | +pub const SIGQUIT: Signal = __WASI_SIGQUIT; | |
347 | +pub const SIGILL: Signal = __WASI_SIGILL; | |
348 | +pub const SIGTRAP: Signal = __WASI_SIGTRAP; | |
349 | +pub const SIGABRT: Signal = __WASI_SIGABRT; | |
350 | +pub const SIGBUS: Signal = __WASI_SIGBUS; | |
351 | +pub const SIGFPE: Signal = __WASI_SIGFPE; | |
352 | +pub const SIGKILL: Signal = __WASI_SIGKILL; | |
353 | +pub const SIGUSR1: Signal = __WASI_SIGUSR1; | |
354 | +pub const SIGSEGV: Signal = __WASI_SIGSEGV; | |
355 | +pub const SIGUSR2: Signal = __WASI_SIGUSR2; | |
356 | +pub const SIGPIPE: Signal = __WASI_SIGPIPE; | |
357 | +pub const SIGALRM: Signal = __WASI_SIGALRM; | |
358 | +pub const SIGTERM: Signal = __WASI_SIGTERM; | |
359 | +pub const SIGCHLD: Signal = __WASI_SIGCHLD; | |
360 | +pub const SIGCONT: Signal = __WASI_SIGCONT; | |
361 | +pub const SIGSTOP: Signal = __WASI_SIGSTOP; | |
362 | +pub const SIGTSTP: Signal = __WASI_SIGTSTP; | |
363 | +pub const SIGTTIN: Signal = __WASI_SIGTTIN; | |
364 | +pub const SIGTTOU: Signal = __WASI_SIGTTOU; | |
365 | +pub const SIGURG: Signal = __WASI_SIGURG; | |
366 | +pub const SIGXCPU: Signal = __WASI_SIGXCPU; | |
367 | +pub const SIGXFSZ: Signal = __WASI_SIGXFSZ; | |
368 | +pub const SIGVTALRM: Signal = __WASI_SIGVTALRM; | |
369 | +pub const SIGPROF: Signal = __WASI_SIGPROF; | |
370 | +pub const SIGWINCH: Signal = __WASI_SIGWINCH; | |
371 | +pub const SIGPOLL: Signal = __WASI_SIGPOLL; | |
372 | +pub const SIGPWR: Signal = __WASI_SIGPWR; | |
373 | +pub const SIGSYS: Signal = __WASI_SIGSYS; | |
374 | +pub const SOCK_RECV_DATA_TRUNCATED: Roflags = __WASI_SOCK_RECV_DATA_TRUNCATED; | |
375 | + | |
376 | +bitflags! { | |
377 | + pub struct Sdflags: __wasi_sdflags_t { | |
378 | + const SHUT_RD = __WASI_SHUT_RD; | |
379 | + const SHUT_WR = __WASI_SHUT_WR; | |
380 | + } | |
381 | +} | |
382 | + | |
383 | +bitflags! { | |
384 | + pub struct Riflags: __wasi_riflags_t { | |
385 | + const PEEK = __WASI_SOCK_RECV_PEEK; | |
386 | + const WAITALL = __WASI_SOCK_RECV_WAITALL; | |
387 | + } | |
388 | +} | |
389 | + | |
390 | +bitflags! { | |
391 | + pub struct Eventrwflags: __wasi_eventrwflags_t { | |
392 | + const FD_READWRITE_HANGUP = __WASI_EVENT_FD_READWRITE_HANGUP; | |
393 | + } | |
394 | +} | |
395 | + | |
396 | +bitflags! { | |
397 | + pub struct Subclockflags: __wasi_subclockflags_t { | |
398 | + const SUBSCRIPTION_CLOCK_ABSTIME = __WASI_SUBSCRIPTION_CLOCK_ABSTIME; | |
399 | + } | |
400 | +} | |
401 | + | |
402 | +bitflags! { | |
403 | + pub struct Oflags: __wasi_oflags_t { | |
404 | + const CREAT = __WASI_O_CREAT; | |
405 | + const DIRECTORY = __WASI_O_DIRECTORY; | |
406 | + const EXCL = __WASI_O_EXCL; | |
407 | + const TRUNC = __WASI_O_TRUNC; | |
408 | + } | |
409 | +} | |
410 | + | |
411 | +bitflags! { | |
412 | + pub struct Fdflags: __wasi_fdflags_t { | |
413 | + const APPEND = __WASI_FDFLAG_APPEND; | |
414 | + const DSYNC = __WASI_FDFLAG_DSYNC; | |
415 | + const NONBLOCK = __WASI_FDFLAG_NONBLOCK; | |
416 | + const RSYNC = __WASI_FDFLAG_RSYNC; | |
417 | + const SYNC = __WASI_FDFLAG_SYNC; | |
418 | + } | |
419 | +} | |
420 | + | |
421 | +bitflags! { | |
422 | + pub struct Lookupflags: __wasi_lookupflags_t { | |
423 | + const SYMLINK_FOLLOW = __WASI_LOOKUP_SYMLINK_FOLLOW; | |
424 | + } | |
425 | +} | |
426 | + | |
427 | +bitflags! { | |
428 | + pub struct Rights: __wasi_rights_t { | |
429 | + const FD_DATASYNC = __WASI_RIGHT_FD_DATASYNC; | |
430 | + const FD_READ = __WASI_RIGHT_FD_READ; | |
431 | + const FD_SEEK = __WASI_RIGHT_FD_SEEK; | |
432 | + const FD_FDSTAT_SET_FLAGS = __WASI_RIGHT_FD_FDSTAT_SET_FLAGS; | |
433 | + const FD_SYNC = __WASI_RIGHT_FD_SYNC; | |
434 | + const FD_TELL = __WASI_RIGHT_FD_TELL; | |
435 | + const FD_WRITE = __WASI_RIGHT_FD_WRITE; | |
436 | + const FD_ADVISE = __WASI_RIGHT_FD_ADVISE; | |
437 | + const FD_ALLOCATE = __WASI_RIGHT_FD_ALLOCATE; | |
438 | + const PATH_CREATE_DIRECTORY = __WASI_RIGHT_PATH_CREATE_DIRECTORY; | |
439 | + const PATH_CREATE_FILE = __WASI_RIGHT_PATH_CREATE_FILE; | |
440 | + const PATH_LINK_SOURCE = __WASI_RIGHT_PATH_LINK_SOURCE; | |
441 | + const PATH_LINK_TARGET = __WASI_RIGHT_PATH_LINK_TARGET; | |
442 | + const PATH_OPEN = __WASI_RIGHT_PATH_OPEN; | |
443 | + const FD_READDIR = __WASI_RIGHT_FD_READDIR; | |
444 | + const PATH_READLINK = __WASI_RIGHT_PATH_READLINK; | |
445 | + const PATH_RENAME_SOURCE = __WASI_RIGHT_PATH_RENAME_SOURCE; | |
446 | + const PATH_RENAME_TARGET = __WASI_RIGHT_PATH_RENAME_TARGET; | |
447 | + const PATH_FILESTAT_GET = __WASI_RIGHT_PATH_FILESTAT_GET; | |
448 | + const PATH_FILESTAT_SET_SIZE = __WASI_RIGHT_PATH_FILESTAT_SET_SIZE; | |
449 | + const PATH_FILESTAT_SET_TIMES = __WASI_RIGHT_PATH_FILESTAT_SET_TIMES; | |
450 | + const FD_FILESTAT_GET = __WASI_RIGHT_FD_FILESTAT_GET; | |
451 | + const FD_FILESTAT_SET_SIZE = __WASI_RIGHT_FD_FILESTAT_SET_SIZE; | |
452 | + const FD_FILESTAT_SET_TIMES = __WASI_RIGHT_FD_FILESTAT_SET_TIMES; | |
453 | + const PATH_SYMLINK = __WASI_RIGHT_PATH_SYMLINK; | |
454 | + const PATH_REMOVE_DIRECTORY = __WASI_RIGHT_PATH_REMOVE_DIRECTORY; | |
455 | + const PATH_UNLINK_FILE = __WASI_RIGHT_PATH_UNLINK_FILE; | |
456 | + const POLL_FD_READWRITE = __WASI_RIGHT_POLL_FD_READWRITE; | |
457 | + const SOCK_SHUTDOWN = __WASI_RIGHT_SOCK_SHUTDOWN; | |
458 | + } | |
459 | +} | |
460 | + | |
461 | +bitflags! { | |
462 | + pub struct Fstflags: __wasi_fstflags_t { | |
463 | + const SET_ATIM = __WASI_FILESTAT_SET_ATIM; | |
464 | + const SET_ATIM_NOW = __WASI_FILESTAT_SET_ATIM_NOW; | |
465 | + const SET_MTIM = __WASI_FILESTAT_SET_MTIM; | |
466 | + const SET_MTIM_NOW = __WASI_FILESTAT_SET_MTIM_NOW; | |
467 | + } | |
468 | +} | |
469 | ||
470 | pub fn clock_res_get(clock_id: Clockid) -> (Errno, Timestamp) { | |
471 | let mut resolution = MaybeUninit::<Timestamp>::uninit(); | |
472 | @@ -333,11 +366,11 @@ pub fn fd_fdstat_get(fd: Fd) -> (Errno, Fdstat) { | |
473 | } | |
474 | ||
475 | pub fn fd_fdstat_set_flags(fd: Fd, flags: Fdflags) -> Errno { | |
476 | - unsafe { __wasi_fd_fdstat_set_flags(fd, flags) } | |
477 | + unsafe { __wasi_fd_fdstat_set_flags(fd, flags.bits()) } | |
478 | } | |
479 | ||
480 | pub fn fd_fdstat_set_rights(fd: Fd, fs_rights_base: Rights, fs_rights_inheriting: Rights) -> Errno { | |
481 | - unsafe { __wasi_fd_fdstat_set_rights(fd, fs_rights_base, fs_rights_inheriting) } | |
482 | + unsafe { __wasi_fd_fdstat_set_rights(fd, fs_rights_base.bits(), fs_rights_inheriting.bits()) } | |
483 | } | |
484 | ||
485 | pub fn fd_sync(fd: Fd) -> Errno { | |
486 | @@ -376,7 +409,7 @@ pub fn path_link( | |
487 | unsafe { | |
488 | __wasi_path_link( | |
489 | old_fd, | |
490 | - old_flags, | |
491 | + old_flags.bits(), | |
492 | old_path.as_ptr(), | |
493 | old_path.len(), | |
494 | new_fd, | |
495 | @@ -400,13 +433,13 @@ pub fn path_open( | |
496 | ( | |
497 | __wasi_path_open( | |
498 | dirfd, | |
499 | - dirflags, | |
500 | + dirflags.bits(), | |
501 | path.as_ptr(), | |
502 | path.len(), | |
503 | - oflags, | |
504 | - fs_rights_base, | |
505 | - fs_rights_inheriting, | |
506 | - fs_flags, | |
507 | + oflags.bits(), | |
508 | + fs_rights_base.bits(), | |
509 | + fs_rights_inheriting.bits(), | |
510 | + fs_flags.bits(), | |
511 | fd.as_mut_ptr(), | |
512 | ), | |
513 | fd.assume_init(), | |
514 | @@ -476,7 +509,7 @@ pub fn fd_filestat_set_times( | |
515 | st_mtim: Timestamp, | |
516 | fstflags: Fstflags, | |
517 | ) -> Errno { | |
518 | - unsafe { __wasi_fd_filestat_set_times(fd, st_atim, st_mtim, fstflags) } | |
519 | + unsafe { __wasi_fd_filestat_set_times(fd, st_atim, st_mtim, fstflags.bits()) } | |
520 | } | |
521 | ||
522 | pub fn fd_filestat_set_size(fd: Fd, st_size: Filesize) -> Errno { | |
523 | @@ -487,7 +520,13 @@ pub fn path_filestat_get(fd: Fd, flags: Lookupflags, path: &[u8]) -> (Errno, Fil | |
524 | let mut buf = MaybeUninit::<Filestat>::uninit(); | |
525 | unsafe { | |
526 | ( | |
527 | - __wasi_path_filestat_get(fd, flags, path.as_ptr(), path.len(), buf.as_mut_ptr()), | |
528 | + __wasi_path_filestat_get( | |
529 | + fd, | |
530 | + flags.bits(), | |
531 | + path.as_ptr(), | |
532 | + path.len(), | |
533 | + buf.as_mut_ptr(), | |
534 | + ), | |
535 | buf.assume_init(), | |
536 | ) | |
537 | } | |
538 | @@ -504,12 +543,12 @@ pub fn path_filestat_set_times( | |
539 | unsafe { | |
540 | __wasi_path_filestat_set_times( | |
541 | fd, | |
542 | - flags, | |
543 | + flags.bits(), | |
544 | path.as_ptr(), | |
545 | path.len(), | |
546 | st_atim, | |
547 | st_mtim, | |
548 | - fstflags, | |
549 | + fstflags.bits(), | |
550 | ) | |
551 | } | |
552 | } | |
553 | @@ -567,7 +606,7 @@ pub fn sock_recv(sock: Fd, ri_data: &[Iovec], ri_flags: Riflags) -> (Errno, usiz | |
554 | sock, | |
555 | ri_data.as_ptr(), | |
556 | ri_data.len(), | |
557 | - ri_flags, | |
558 | + ri_flags.bits(), | |
559 | ro_datalen.as_mut_ptr(), | |
560 | ro_flags.as_mut_ptr(), | |
561 | ), | |
562 | @@ -594,7 +633,7 @@ pub fn sock_send(sock: Fd, si_data: &[Ciovec], si_flags: Siflags) -> (Errno, usi | |
563 | } | |
564 | ||
565 | pub fn sock_shutdown(sock: Fd, how: Sdflags) -> Errno { | |
566 | - unsafe { __wasi_sock_shutdown(sock, how) } | |
567 | + unsafe { __wasi_sock_shutdown(sock, how.bits()) } | |
568 | } | |
569 | ||
570 | pub fn sched_yield() -> Errno { |