571 lines
24 KiB
Diff
571 lines
24 KiB
Diff
diff --git a/Cargo.toml b/Cargo.toml
|
|
index 47ecced..ec6e7c9 100644
|
|
--- a/Cargo.toml
|
|
+++ b/Cargo.toml
|
|
@@ -12,6 +12,7 @@ readme = "README.md"
|
|
documentation = "https://docs.rs/wasi"
|
|
|
|
[dependencies]
|
|
+bitflags = "1.1.0"
|
|
|
|
[badges]
|
|
maintenance = { status = "experimental" }
|
|
diff --git a/src/lib.rs b/src/lib.rs
|
|
index 42e13ea..03d3d19 100644
|
|
--- a/src/lib.rs
|
|
+++ b/src/lib.rs
|
|
@@ -13,4 +13,7 @@
|
|
)]
|
|
#![no_std]
|
|
|
|
+#[macro_use]
|
|
+extern crate bitflags;
|
|
+
|
|
pub mod wasi_unstable;
|
|
diff --git a/src/wasi_unstable/mod.rs b/src/wasi_unstable/mod.rs
|
|
index 4703cc9..b3fd897 100644
|
|
--- a/src/wasi_unstable/mod.rs
|
|
+++ b/src/wasi_unstable/mod.rs
|
|
@@ -19,27 +19,18 @@ pub type Clockid = __wasi_clockid_t;
|
|
pub type Device = __wasi_device_t;
|
|
pub type Dircookie = __wasi_dircookie_t;
|
|
pub type Errno = __wasi_errno_t;
|
|
-pub type Eventrwflags = __wasi_eventrwflags_t;
|
|
pub type Eventtype = __wasi_eventtype_t;
|
|
pub type Exitcode = __wasi_exitcode_t;
|
|
pub type Fd = __wasi_fd_t;
|
|
-pub type Fdflags = __wasi_fdflags_t;
|
|
pub type Filedelta = __wasi_filedelta_t;
|
|
pub type Filesize = __wasi_filesize_t;
|
|
pub type Filetype = __wasi_filetype_t;
|
|
-pub type Fstflags = __wasi_fstflags_t;
|
|
pub type Inode = __wasi_inode_t;
|
|
pub type Linkcount = __wasi_linkcount_t;
|
|
-pub type Lookupflags = __wasi_lookupflags_t;
|
|
-pub type Oflags = __wasi_oflags_t;
|
|
pub type Preopentype = __wasi_preopentype_t;
|
|
-pub type Riflags = __wasi_riflags_t;
|
|
-pub type Rights = __wasi_rights_t;
|
|
pub type Roflags = __wasi_roflags_t;
|
|
-pub type Sdflags = __wasi_sdflags_t;
|
|
pub type Siflags = __wasi_siflags_t;
|
|
pub type Signal = __wasi_signal_t;
|
|
-pub type Subclockflags = __wasi_subclockflags_t;
|
|
pub type Timestamp = __wasi_timestamp_t;
|
|
pub type Userdata = __wasi_userdata_t;
|
|
pub type Whence = __wasi_whence_t;
|
|
@@ -52,189 +43,231 @@ pub type Subscription = __wasi_subscription_t;
|
|
pub type Event = __wasi_event_t;
|
|
pub type Prestat = __wasi_prestat_t;
|
|
|
|
-pub const ADVICE_NORMAL: u8 = __WASI_ADVICE_NORMAL;
|
|
-pub const ADVICE_SEQUENTIAL: u8 = __WASI_ADVICE_SEQUENTIAL;
|
|
-pub const ADVICE_RANDOM: u8 = __WASI_ADVICE_RANDOM;
|
|
-pub const ADVICE_WILLNEED: u8 = __WASI_ADVICE_WILLNEED;
|
|
-pub const ADVICE_DONTNEED: u8 = __WASI_ADVICE_DONTNEED;
|
|
-pub const ADVICE_NOREUSE: u8 = __WASI_ADVICE_NOREUSE;
|
|
-pub const CLOCK_REALTIME: u32 = __WASI_CLOCK_REALTIME;
|
|
-pub const CLOCK_MONOTONIC: u32 = __WASI_CLOCK_MONOTONIC;
|
|
-pub const CLOCK_PROCESS_CPUTIME_ID: u32 = __WASI_CLOCK_PROCESS_CPUTIME_ID;
|
|
-pub const CLOCK_THREAD_CPUTIME_ID: u32 = __WASI_CLOCK_THREAD_CPUTIME_ID;
|
|
-pub const DIRCOOKIE_START: u64 = __WASI_DIRCOOKIE_START;
|
|
-pub const ESUCCESS: u16 = __WASI_ESUCCESS;
|
|
-pub const E2BIG: u16 = __WASI_E2BIG;
|
|
-pub const EACCES: u16 = __WASI_EACCES;
|
|
-pub const EADDRINUSE: u16 = __WASI_EADDRINUSE;
|
|
-pub const EADDRNOTAVAIL: u16 = __WASI_EADDRNOTAVAIL;
|
|
-pub const EAFNOSUPPORT: u16 = __WASI_EAFNOSUPPORT;
|
|
-pub const EAGAIN: u16 = __WASI_EAGAIN;
|
|
-pub const EALREADY: u16 = __WASI_EALREADY;
|
|
-pub const EBADF: u16 = __WASI_EBADF;
|
|
-pub const EBADMSG: u16 = __WASI_EBADMSG;
|
|
-pub const EBUSY: u16 = __WASI_EBUSY;
|
|
-pub const ECANCELED: u16 = __WASI_ECANCELED;
|
|
-pub const ECHILD: u16 = __WASI_ECHILD;
|
|
-pub const ECONNABORTED: u16 = __WASI_ECONNABORTED;
|
|
-pub const ECONNREFUSED: u16 = __WASI_ECONNREFUSED;
|
|
-pub const ECONNRESET: u16 = __WASI_ECONNRESET;
|
|
-pub const EDEADLK: u16 = __WASI_EDEADLK;
|
|
-pub const EDESTADDRREQ: u16 = __WASI_EDESTADDRREQ;
|
|
-pub const EDOM: u16 = __WASI_EDOM;
|
|
-pub const EDQUOT: u16 = __WASI_EDQUOT;
|
|
-pub const EEXIST: u16 = __WASI_EEXIST;
|
|
-pub const EFAULT: u16 = __WASI_EFAULT;
|
|
-pub const EFBIG: u16 = __WASI_EFBIG;
|
|
-pub const EHOSTUNREACH: u16 = __WASI_EHOSTUNREACH;
|
|
-pub const EIDRM: u16 = __WASI_EIDRM;
|
|
-pub const EILSEQ: u16 = __WASI_EILSEQ;
|
|
-pub const EINPROGRESS: u16 = __WASI_EINPROGRESS;
|
|
-pub const EINTR: u16 = __WASI_EINTR;
|
|
-pub const EINVAL: u16 = __WASI_EINVAL;
|
|
-pub const EIO: u16 = __WASI_EIO;
|
|
-pub const EISCONN: u16 = __WASI_EISCONN;
|
|
-pub const EISDIR: u16 = __WASI_EISDIR;
|
|
-pub const ELOOP: u16 = __WASI_ELOOP;
|
|
-pub const EMFILE: u16 = __WASI_EMFILE;
|
|
-pub const EMLINK: u16 = __WASI_EMLINK;
|
|
-pub const EMSGSIZE: u16 = __WASI_EMSGSIZE;
|
|
-pub const EMULTIHOP: u16 = __WASI_EMULTIHOP;
|
|
-pub const ENAMETOOLONG: u16 = __WASI_ENAMETOOLONG;
|
|
-pub const ENETDOWN: u16 = __WASI_ENETDOWN;
|
|
-pub const ENETRESET: u16 = __WASI_ENETRESET;
|
|
-pub const ENETUNREACH: u16 = __WASI_ENETUNREACH;
|
|
-pub const ENFILE: u16 = __WASI_ENFILE;
|
|
-pub const ENOBUFS: u16 = __WASI_ENOBUFS;
|
|
-pub const ENODEV: u16 = __WASI_ENODEV;
|
|
-pub const ENOENT: u16 = __WASI_ENOENT;
|
|
-pub const ENOEXEC: u16 = __WASI_ENOEXEC;
|
|
-pub const ENOLCK: u16 = __WASI_ENOLCK;
|
|
-pub const ENOLINK: u16 = __WASI_ENOLINK;
|
|
-pub const ENOMEM: u16 = __WASI_ENOMEM;
|
|
-pub const ENOMSG: u16 = __WASI_ENOMSG;
|
|
-pub const ENOPROTOOPT: u16 = __WASI_ENOPROTOOPT;
|
|
-pub const ENOSPC: u16 = __WASI_ENOSPC;
|
|
-pub const ENOSYS: u16 = __WASI_ENOSYS;
|
|
-pub const ENOTCONN: u16 = __WASI_ENOTCONN;
|
|
-pub const ENOTDIR: u16 = __WASI_ENOTDIR;
|
|
-pub const ENOTEMPTY: u16 = __WASI_ENOTEMPTY;
|
|
-pub const ENOTRECOVERABLE: u16 = __WASI_ENOTRECOVERABLE;
|
|
-pub const ENOTSOCK: u16 = __WASI_ENOTSOCK;
|
|
-pub const ENOTSUP: u16 = __WASI_ENOTSUP;
|
|
-pub const ENOTTY: u16 = __WASI_ENOTTY;
|
|
-pub const ENXIO: u16 = __WASI_ENXIO;
|
|
-pub const EOVERFLOW: u16 = __WASI_EOVERFLOW;
|
|
-pub const EOWNERDEAD: u16 = __WASI_EOWNERDEAD;
|
|
-pub const EPERM: u16 = __WASI_EPERM;
|
|
-pub const EPIPE: u16 = __WASI_EPIPE;
|
|
-pub const EPROTO: u16 = __WASI_EPROTO;
|
|
-pub const EPROTONOSUPPORT: u16 = __WASI_EPROTONOSUPPORT;
|
|
-pub const EPROTOTYPE: u16 = __WASI_EPROTOTYPE;
|
|
-pub const ERANGE: u16 = __WASI_ERANGE;
|
|
-pub const EROFS: u16 = __WASI_EROFS;
|
|
-pub const ESPIPE: u16 = __WASI_ESPIPE;
|
|
-pub const ESRCH: u16 = __WASI_ESRCH;
|
|
-pub const ESTALE: u16 = __WASI_ESTALE;
|
|
-pub const ETIMEDOUT: u16 = __WASI_ETIMEDOUT;
|
|
-pub const ETXTBSY: u16 = __WASI_ETXTBSY;
|
|
-pub const EXDEV: u16 = __WASI_EXDEV;
|
|
-pub const ENOTCAPABLE: u16 = __WASI_ENOTCAPABLE;
|
|
-pub const EVENT_FD_READWRITE_HANGUP: u16 = __WASI_EVENT_FD_READWRITE_HANGUP;
|
|
-pub const EVENTTYPE_CLOCK: u8 = __WASI_EVENTTYPE_CLOCK;
|
|
-pub const EVENTTYPE_FD_READ: u8 = __WASI_EVENTTYPE_FD_READ;
|
|
-pub const EVENTTYPE_FD_WRITE: u8 = __WASI_EVENTTYPE_FD_WRITE;
|
|
-pub const FDFLAG_APPEND: u16 = __WASI_FDFLAG_APPEND;
|
|
-pub const FDFLAG_DSYNC: u16 = __WASI_FDFLAG_DSYNC;
|
|
-pub const FDFLAG_NONBLOCK: u16 = __WASI_FDFLAG_NONBLOCK;
|
|
-pub const FDFLAG_RSYNC: u16 = __WASI_FDFLAG_RSYNC;
|
|
-pub const FDFLAG_SYNC: u16 = __WASI_FDFLAG_SYNC;
|
|
-pub const FILETYPE_UNKNOWN: u8 = __WASI_FILETYPE_UNKNOWN;
|
|
-pub const FILETYPE_BLOCK_DEVICE: u8 = __WASI_FILETYPE_BLOCK_DEVICE;
|
|
-pub const FILETYPE_CHARACTER_DEVICE: u8 = __WASI_FILETYPE_CHARACTER_DEVICE;
|
|
-pub const FILETYPE_DIRECTORY: u8 = __WASI_FILETYPE_DIRECTORY;
|
|
-pub const FILETYPE_REGULAR_FILE: u8 = __WASI_FILETYPE_REGULAR_FILE;
|
|
-pub const FILETYPE_SOCKET_DGRAM: u8 = __WASI_FILETYPE_SOCKET_DGRAM;
|
|
-pub const FILETYPE_SOCKET_STREAM: u8 = __WASI_FILETYPE_SOCKET_STREAM;
|
|
-pub const FILETYPE_SYMBOLIC_LINK: u8 = __WASI_FILETYPE_SYMBOLIC_LINK;
|
|
-pub const FILESTAT_SET_ATIM: u16 = __WASI_FILESTAT_SET_ATIM;
|
|
-pub const FILESTAT_SET_ATIM_NOW: u16 = __WASI_FILESTAT_SET_ATIM_NOW;
|
|
-pub const FILESTAT_SET_MTIM: u16 = __WASI_FILESTAT_SET_MTIM;
|
|
-pub const FILESTAT_SET_MTIM_NOW: u16 = __WASI_FILESTAT_SET_MTIM_NOW;
|
|
-pub const LOOKUP_SYMLINK_FOLLOW: u32 = __WASI_LOOKUP_SYMLINK_FOLLOW;
|
|
-pub const O_CREAT: u16 = __WASI_O_CREAT;
|
|
-pub const O_DIRECTORY: u16 = __WASI_O_DIRECTORY;
|
|
-pub const O_EXCL: u16 = __WASI_O_EXCL;
|
|
-pub const O_TRUNC: u16 = __WASI_O_TRUNC;
|
|
-pub const PREOPENTYPE_DIR: u8 = __WASI_PREOPENTYPE_DIR;
|
|
-pub const SOCK_RECV_PEEK: u16 = __WASI_SOCK_RECV_PEEK;
|
|
-pub const SOCK_RECV_WAITALL: u16 = __WASI_SOCK_RECV_WAITALL;
|
|
-pub const RIGHT_FD_DATASYNC: u64 = __WASI_RIGHT_FD_DATASYNC;
|
|
-pub const RIGHT_FD_READ: u64 = __WASI_RIGHT_FD_READ;
|
|
-pub const RIGHT_FD_SEEK: u64 = __WASI_RIGHT_FD_SEEK;
|
|
-pub const RIGHT_FD_FDSTAT_SET_FLAGS: u64 = __WASI_RIGHT_FD_FDSTAT_SET_FLAGS;
|
|
-pub const RIGHT_FD_SYNC: u64 = __WASI_RIGHT_FD_SYNC;
|
|
-pub const RIGHT_FD_TELL: u64 = __WASI_RIGHT_FD_TELL;
|
|
-pub const RIGHT_FD_WRITE: u64 = __WASI_RIGHT_FD_WRITE;
|
|
-pub const RIGHT_FD_ADVISE: u64 = __WASI_RIGHT_FD_ADVISE;
|
|
-pub const RIGHT_FD_ALLOCATE: u64 = __WASI_RIGHT_FD_ALLOCATE;
|
|
-pub const RIGHT_PATH_CREATE_DIRECTORY: u64 = __WASI_RIGHT_PATH_CREATE_DIRECTORY;
|
|
-pub const RIGHT_PATH_CREATE_FILE: u64 = __WASI_RIGHT_PATH_CREATE_FILE;
|
|
-pub const RIGHT_PATH_LINK_SOURCE: u64 = __WASI_RIGHT_PATH_LINK_SOURCE;
|
|
-pub const RIGHT_PATH_LINK_TARGET: u64 = __WASI_RIGHT_PATH_LINK_TARGET;
|
|
-pub const RIGHT_PATH_OPEN: u64 = __WASI_RIGHT_PATH_OPEN;
|
|
-pub const RIGHT_FD_READDIR: u64 = __WASI_RIGHT_FD_READDIR;
|
|
-pub const RIGHT_PATH_READLINK: u64 = __WASI_RIGHT_PATH_READLINK;
|
|
-pub const RIGHT_PATH_RENAME_SOURCE: u64 = __WASI_RIGHT_PATH_RENAME_SOURCE;
|
|
-pub const RIGHT_PATH_RENAME_TARGET: u64 = __WASI_RIGHT_PATH_RENAME_TARGET;
|
|
-pub const RIGHT_PATH_FILESTAT_GET: u64 = __WASI_RIGHT_PATH_FILESTAT_GET;
|
|
-pub const RIGHT_PATH_FILESTAT_SET_SIZE: u64 = __WASI_RIGHT_PATH_FILESTAT_SET_SIZE;
|
|
-pub const RIGHT_PATH_FILESTAT_SET_TIMES: u64 = __WASI_RIGHT_PATH_FILESTAT_SET_TIMES;
|
|
-pub const RIGHT_FD_FILESTAT_GET: u64 = __WASI_RIGHT_FD_FILESTAT_GET;
|
|
-pub const RIGHT_FD_FILESTAT_SET_SIZE: u64 = __WASI_RIGHT_FD_FILESTAT_SET_SIZE;
|
|
-pub const RIGHT_FD_FILESTAT_SET_TIMES: u64 = __WASI_RIGHT_FD_FILESTAT_SET_TIMES;
|
|
-pub const RIGHT_PATH_SYMLINK: u64 = __WASI_RIGHT_PATH_SYMLINK;
|
|
-pub const RIGHT_PATH_REMOVE_DIRECTORY: u64 = __WASI_RIGHT_PATH_REMOVE_DIRECTORY;
|
|
-pub const RIGHT_PATH_UNLINK_FILE: u64 = __WASI_RIGHT_PATH_UNLINK_FILE;
|
|
-pub const RIGHT_POLL_FD_READWRITE: u64 = __WASI_RIGHT_POLL_FD_READWRITE;
|
|
-pub const RIGHT_SOCK_SHUTDOWN: u64 = __WASI_RIGHT_SOCK_SHUTDOWN;
|
|
-pub const SOCK_RECV_DATA_TRUNCATED: u16 = __WASI_SOCK_RECV_DATA_TRUNCATED;
|
|
-pub const SHUT_RD: u8 = __WASI_SHUT_RD;
|
|
-pub const SHUT_WR: u8 = __WASI_SHUT_WR;
|
|
-pub const SIGHUP: u8 = __WASI_SIGHUP;
|
|
-pub const SIGINT: u8 = __WASI_SIGINT;
|
|
-pub const SIGQUIT: u8 = __WASI_SIGQUIT;
|
|
-pub const SIGILL: u8 = __WASI_SIGILL;
|
|
-pub const SIGTRAP: u8 = __WASI_SIGTRAP;
|
|
-pub const SIGABRT: u8 = __WASI_SIGABRT;
|
|
-pub const SIGBUS: u8 = __WASI_SIGBUS;
|
|
-pub const SIGFPE: u8 = __WASI_SIGFPE;
|
|
-pub const SIGKILL: u8 = __WASI_SIGKILL;
|
|
-pub const SIGUSR1: u8 = __WASI_SIGUSR1;
|
|
-pub const SIGSEGV: u8 = __WASI_SIGSEGV;
|
|
-pub const SIGUSR2: u8 = __WASI_SIGUSR2;
|
|
-pub const SIGPIPE: u8 = __WASI_SIGPIPE;
|
|
-pub const SIGALRM: u8 = __WASI_SIGALRM;
|
|
-pub const SIGTERM: u8 = __WASI_SIGTERM;
|
|
-pub const SIGCHLD: u8 = __WASI_SIGCHLD;
|
|
-pub const SIGCONT: u8 = __WASI_SIGCONT;
|
|
-pub const SIGSTOP: u8 = __WASI_SIGSTOP;
|
|
-pub const SIGTSTP: u8 = __WASI_SIGTSTP;
|
|
-pub const SIGTTIN: u8 = __WASI_SIGTTIN;
|
|
-pub const SIGTTOU: u8 = __WASI_SIGTTOU;
|
|
-pub const SIGURG: u8 = __WASI_SIGURG;
|
|
-pub const SIGXCPU: u8 = __WASI_SIGXCPU;
|
|
-pub const SIGXFSZ: u8 = __WASI_SIGXFSZ;
|
|
-pub const SIGVTALRM: u8 = __WASI_SIGVTALRM;
|
|
-pub const SIGPROF: u8 = __WASI_SIGPROF;
|
|
-pub const SIGWINCH: u8 = __WASI_SIGWINCH;
|
|
-pub const SIGPOLL: u8 = __WASI_SIGPOLL;
|
|
-pub const SIGPWR: u8 = __WASI_SIGPWR;
|
|
-pub const SIGSYS: u8 = __WASI_SIGSYS;
|
|
-pub const SUBSCRIPTION_CLOCK_ABSTIME: u16 = __WASI_SUBSCRIPTION_CLOCK_ABSTIME;
|
|
-pub const WHENCE_CUR: u8 = __WASI_WHENCE_CUR;
|
|
-pub const WHENCE_END: u8 = __WASI_WHENCE_END;
|
|
-pub const WHENCE_SET: u8 = __WASI_WHENCE_SET;
|
|
+pub const ADVICE_NORMAL: Advice = __WASI_ADVICE_NORMAL;
|
|
+pub const ADVICE_SEQUENTIAL: Advice = __WASI_ADVICE_SEQUENTIAL;
|
|
+pub const ADVICE_RANDOM: Advice = __WASI_ADVICE_RANDOM;
|
|
+pub const ADVICE_WILLNEED: Advice = __WASI_ADVICE_WILLNEED;
|
|
+pub const ADVICE_DONTNEED: Advice = __WASI_ADVICE_DONTNEED;
|
|
+pub const ADVICE_NOREUSE: Advice = __WASI_ADVICE_NOREUSE;
|
|
+pub const CLOCK_REALTIME: Clockid = __WASI_CLOCK_REALTIME;
|
|
+pub const CLOCK_MONOTONIC: Clockid = __WASI_CLOCK_MONOTONIC;
|
|
+pub const CLOCK_PROCESS_CPUTIME_ID: Clockid = __WASI_CLOCK_PROCESS_CPUTIME_ID;
|
|
+pub const CLOCK_THREAD_CPUTIME_ID: Clockid = __WASI_CLOCK_THREAD_CPUTIME_ID;
|
|
+pub const DIRCOOKIE_START: Dircookie = __WASI_DIRCOOKIE_START;
|
|
+pub const ESUCCESS: Errno = __WASI_ESUCCESS;
|
|
+pub const E2BIG: Errno = __WASI_E2BIG;
|
|
+pub const EACCES: Errno = __WASI_EACCES;
|
|
+pub const EADDRINUSE: Errno = __WASI_EADDRINUSE;
|
|
+pub const EADDRNOTAVAIL: Errno = __WASI_EADDRNOTAVAIL;
|
|
+pub const EAFNOSUPPORT: Errno = __WASI_EAFNOSUPPORT;
|
|
+pub const EAGAIN: Errno = __WASI_EAGAIN;
|
|
+pub const EALREADY: Errno = __WASI_EALREADY;
|
|
+pub const EBADF: Errno = __WASI_EBADF;
|
|
+pub const EBADMSG: Errno = __WASI_EBADMSG;
|
|
+pub const EBUSY: Errno = __WASI_EBUSY;
|
|
+pub const ECANCELED: Errno = __WASI_ECANCELED;
|
|
+pub const ECHILD: Errno = __WASI_ECHILD;
|
|
+pub const ECONNABORTED: Errno = __WASI_ECONNABORTED;
|
|
+pub const ECONNREFUSED: Errno = __WASI_ECONNREFUSED;
|
|
+pub const ECONNRESET: Errno = __WASI_ECONNRESET;
|
|
+pub const EDEADLK: Errno = __WASI_EDEADLK;
|
|
+pub const EDESTADDRREQ: Errno = __WASI_EDESTADDRREQ;
|
|
+pub const EDOM: Errno = __WASI_EDOM;
|
|
+pub const EDQUOT: Errno = __WASI_EDQUOT;
|
|
+pub const EEXIST: Errno = __WASI_EEXIST;
|
|
+pub const EFAULT: Errno = __WASI_EFAULT;
|
|
+pub const EFBIG: Errno = __WASI_EFBIG;
|
|
+pub const EHOSTUNREACH: Errno = __WASI_EHOSTUNREACH;
|
|
+pub const EIDRM: Errno = __WASI_EIDRM;
|
|
+pub const EILSEQ: Errno = __WASI_EILSEQ;
|
|
+pub const EINPROGRESS: Errno = __WASI_EINPROGRESS;
|
|
+pub const EINTR: Errno = __WASI_EINTR;
|
|
+pub const EINVAL: Errno = __WASI_EINVAL;
|
|
+pub const EIO: Errno = __WASI_EIO;
|
|
+pub const EISCONN: Errno = __WASI_EISCONN;
|
|
+pub const EISDIR: Errno = __WASI_EISDIR;
|
|
+pub const ELOOP: Errno = __WASI_ELOOP;
|
|
+pub const EMFILE: Errno = __WASI_EMFILE;
|
|
+pub const EMLINK: Errno = __WASI_EMLINK;
|
|
+pub const EMSGSIZE: Errno = __WASI_EMSGSIZE;
|
|
+pub const EMULTIHOP: Errno = __WASI_EMULTIHOP;
|
|
+pub const ENAMETOOLONG: Errno = __WASI_ENAMETOOLONG;
|
|
+pub const ENETDOWN: Errno = __WASI_ENETDOWN;
|
|
+pub const ENETRESET: Errno = __WASI_ENETRESET;
|
|
+pub const ENETUNREACH: Errno = __WASI_ENETUNREACH;
|
|
+pub const ENFILE: Errno = __WASI_ENFILE;
|
|
+pub const ENOBUFS: Errno = __WASI_ENOBUFS;
|
|
+pub const ENODEV: Errno = __WASI_ENODEV;
|
|
+pub const ENOENT: Errno = __WASI_ENOENT;
|
|
+pub const ENOEXEC: Errno = __WASI_ENOEXEC;
|
|
+pub const ENOLCK: Errno = __WASI_ENOLCK;
|
|
+pub const ENOLINK: Errno = __WASI_ENOLINK;
|
|
+pub const ENOMEM: Errno = __WASI_ENOMEM;
|
|
+pub const ENOMSG: Errno = __WASI_ENOMSG;
|
|
+pub const ENOPROTOOPT: Errno = __WASI_ENOPROTOOPT;
|
|
+pub const ENOSPC: Errno = __WASI_ENOSPC;
|
|
+pub const ENOSYS: Errno = __WASI_ENOSYS;
|
|
+pub const ENOTCONN: Errno = __WASI_ENOTCONN;
|
|
+pub const ENOTDIR: Errno = __WASI_ENOTDIR;
|
|
+pub const ENOTEMPTY: Errno = __WASI_ENOTEMPTY;
|
|
+pub const ENOTRECOVERABLE: Errno = __WASI_ENOTRECOVERABLE;
|
|
+pub const ENOTSOCK: Errno = __WASI_ENOTSOCK;
|
|
+pub const ENOTSUP: Errno = __WASI_ENOTSUP;
|
|
+pub const ENOTTY: Errno = __WASI_ENOTTY;
|
|
+pub const ENXIO: Errno = __WASI_ENXIO;
|
|
+pub const EOVERFLOW: Errno = __WASI_EOVERFLOW;
|
|
+pub const EOWNERDEAD: Errno = __WASI_EOWNERDEAD;
|
|
+pub const EPERM: Errno = __WASI_EPERM;
|
|
+pub const EPIPE: Errno = __WASI_EPIPE;
|
|
+pub const EPROTO: Errno = __WASI_EPROTO;
|
|
+pub const EPROTONOSUPPORT: Errno = __WASI_EPROTONOSUPPORT;
|
|
+pub const EPROTOTYPE: Errno = __WASI_EPROTOTYPE;
|
|
+pub const ERANGE: Errno = __WASI_ERANGE;
|
|
+pub const EROFS: Errno = __WASI_EROFS;
|
|
+pub const ESPIPE: Errno = __WASI_ESPIPE;
|
|
+pub const ESRCH: Errno = __WASI_ESRCH;
|
|
+pub const ESTALE: Errno = __WASI_ESTALE;
|
|
+pub const ETIMEDOUT: Errno = __WASI_ETIMEDOUT;
|
|
+pub const ETXTBSY: Errno = __WASI_ETXTBSY;
|
|
+pub const EXDEV: Errno = __WASI_EXDEV;
|
|
+pub const ENOTCAPABLE: Errno = __WASI_ENOTCAPABLE;
|
|
+pub const EVENTTYPE_CLOCK: Eventtype = __WASI_EVENTTYPE_CLOCK;
|
|
+pub const EVENTTYPE_FD_READ: Eventtype = __WASI_EVENTTYPE_FD_READ;
|
|
+pub const EVENTTYPE_FD_WRITE: Eventtype = __WASI_EVENTTYPE_FD_WRITE;
|
|
+pub const FILETYPE_UNKNOWN: Filetype = __WASI_FILETYPE_UNKNOWN;
|
|
+pub const FILETYPE_BLOCK_DEVICE: Filetype = __WASI_FILETYPE_BLOCK_DEVICE;
|
|
+pub const FILETYPE_CHARACTER_DEVICE: Filetype = __WASI_FILETYPE_CHARACTER_DEVICE;
|
|
+pub const FILETYPE_DIRECTORY: Filetype = __WASI_FILETYPE_DIRECTORY;
|
|
+pub const FILETYPE_REGULAR_FILE: Filetype = __WASI_FILETYPE_REGULAR_FILE;
|
|
+pub const FILETYPE_SOCKET_DGRAM: Filetype = __WASI_FILETYPE_SOCKET_DGRAM;
|
|
+pub const FILETYPE_SOCKET_STREAM: Filetype = __WASI_FILETYPE_SOCKET_STREAM;
|
|
+pub const FILETYPE_SYMBOLIC_LINK: Filetype = __WASI_FILETYPE_SYMBOLIC_LINK;
|
|
+pub const PREOPENTYPE_DIR: Preopentype = __WASI_PREOPENTYPE_DIR;
|
|
+pub const SIGHUP: Signal = __WASI_SIGHUP;
|
|
+pub const SIGINT: Signal = __WASI_SIGINT;
|
|
+pub const SIGQUIT: Signal = __WASI_SIGQUIT;
|
|
+pub const SIGILL: Signal = __WASI_SIGILL;
|
|
+pub const SIGTRAP: Signal = __WASI_SIGTRAP;
|
|
+pub const SIGABRT: Signal = __WASI_SIGABRT;
|
|
+pub const SIGBUS: Signal = __WASI_SIGBUS;
|
|
+pub const SIGFPE: Signal = __WASI_SIGFPE;
|
|
+pub const SIGKILL: Signal = __WASI_SIGKILL;
|
|
+pub const SIGUSR1: Signal = __WASI_SIGUSR1;
|
|
+pub const SIGSEGV: Signal = __WASI_SIGSEGV;
|
|
+pub const SIGUSR2: Signal = __WASI_SIGUSR2;
|
|
+pub const SIGPIPE: Signal = __WASI_SIGPIPE;
|
|
+pub const SIGALRM: Signal = __WASI_SIGALRM;
|
|
+pub const SIGTERM: Signal = __WASI_SIGTERM;
|
|
+pub const SIGCHLD: Signal = __WASI_SIGCHLD;
|
|
+pub const SIGCONT: Signal = __WASI_SIGCONT;
|
|
+pub const SIGSTOP: Signal = __WASI_SIGSTOP;
|
|
+pub const SIGTSTP: Signal = __WASI_SIGTSTP;
|
|
+pub const SIGTTIN: Signal = __WASI_SIGTTIN;
|
|
+pub const SIGTTOU: Signal = __WASI_SIGTTOU;
|
|
+pub const SIGURG: Signal = __WASI_SIGURG;
|
|
+pub const SIGXCPU: Signal = __WASI_SIGXCPU;
|
|
+pub const SIGXFSZ: Signal = __WASI_SIGXFSZ;
|
|
+pub const SIGVTALRM: Signal = __WASI_SIGVTALRM;
|
|
+pub const SIGPROF: Signal = __WASI_SIGPROF;
|
|
+pub const SIGWINCH: Signal = __WASI_SIGWINCH;
|
|
+pub const SIGPOLL: Signal = __WASI_SIGPOLL;
|
|
+pub const SIGPWR: Signal = __WASI_SIGPWR;
|
|
+pub const SIGSYS: Signal = __WASI_SIGSYS;
|
|
+pub const SOCK_RECV_DATA_TRUNCATED: Roflags = __WASI_SOCK_RECV_DATA_TRUNCATED;
|
|
+
|
|
+bitflags! {
|
|
+ pub struct Sdflags: __wasi_sdflags_t {
|
|
+ const SHUT_RD = __WASI_SHUT_RD;
|
|
+ const SHUT_WR = __WASI_SHUT_WR;
|
|
+ }
|
|
+}
|
|
+
|
|
+bitflags! {
|
|
+ pub struct Riflags: __wasi_riflags_t {
|
|
+ const PEEK = __WASI_SOCK_RECV_PEEK;
|
|
+ const WAITALL = __WASI_SOCK_RECV_WAITALL;
|
|
+ }
|
|
+}
|
|
+
|
|
+bitflags! {
|
|
+ pub struct Eventrwflags: __wasi_eventrwflags_t {
|
|
+ const FD_READWRITE_HANGUP = __WASI_EVENT_FD_READWRITE_HANGUP;
|
|
+ }
|
|
+}
|
|
+
|
|
+bitflags! {
|
|
+ pub struct Subclockflags: __wasi_subclockflags_t {
|
|
+ const SUBSCRIPTION_CLOCK_ABSTIME = __WASI_SUBSCRIPTION_CLOCK_ABSTIME;
|
|
+ }
|
|
+}
|
|
+
|
|
+bitflags! {
|
|
+ pub struct Oflags: __wasi_oflags_t {
|
|
+ const CREAT = __WASI_O_CREAT;
|
|
+ const DIRECTORY = __WASI_O_DIRECTORY;
|
|
+ const EXCL = __WASI_O_EXCL;
|
|
+ const TRUNC = __WASI_O_TRUNC;
|
|
+ }
|
|
+}
|
|
+
|
|
+bitflags! {
|
|
+ pub struct Fdflags: __wasi_fdflags_t {
|
|
+ const APPEND = __WASI_FDFLAG_APPEND;
|
|
+ const DSYNC = __WASI_FDFLAG_DSYNC;
|
|
+ const NONBLOCK = __WASI_FDFLAG_NONBLOCK;
|
|
+ const RSYNC = __WASI_FDFLAG_RSYNC;
|
|
+ const SYNC = __WASI_FDFLAG_SYNC;
|
|
+ }
|
|
+}
|
|
+
|
|
+bitflags! {
|
|
+ pub struct Lookupflags: __wasi_lookupflags_t {
|
|
+ const SYMLINK_FOLLOW = __WASI_LOOKUP_SYMLINK_FOLLOW;
|
|
+ }
|
|
+}
|
|
+
|
|
+bitflags! {
|
|
+ pub struct Rights: __wasi_rights_t {
|
|
+ const FD_DATASYNC = __WASI_RIGHT_FD_DATASYNC;
|
|
+ const FD_READ = __WASI_RIGHT_FD_READ;
|
|
+ const FD_SEEK = __WASI_RIGHT_FD_SEEK;
|
|
+ const FD_FDSTAT_SET_FLAGS = __WASI_RIGHT_FD_FDSTAT_SET_FLAGS;
|
|
+ const FD_SYNC = __WASI_RIGHT_FD_SYNC;
|
|
+ const FD_TELL = __WASI_RIGHT_FD_TELL;
|
|
+ const FD_WRITE = __WASI_RIGHT_FD_WRITE;
|
|
+ const FD_ADVISE = __WASI_RIGHT_FD_ADVISE;
|
|
+ const FD_ALLOCATE = __WASI_RIGHT_FD_ALLOCATE;
|
|
+ const PATH_CREATE_DIRECTORY = __WASI_RIGHT_PATH_CREATE_DIRECTORY;
|
|
+ const PATH_CREATE_FILE = __WASI_RIGHT_PATH_CREATE_FILE;
|
|
+ const PATH_LINK_SOURCE = __WASI_RIGHT_PATH_LINK_SOURCE;
|
|
+ const PATH_LINK_TARGET = __WASI_RIGHT_PATH_LINK_TARGET;
|
|
+ const PATH_OPEN = __WASI_RIGHT_PATH_OPEN;
|
|
+ const FD_READDIR = __WASI_RIGHT_FD_READDIR;
|
|
+ const PATH_READLINK = __WASI_RIGHT_PATH_READLINK;
|
|
+ const PATH_RENAME_SOURCE = __WASI_RIGHT_PATH_RENAME_SOURCE;
|
|
+ const PATH_RENAME_TARGET = __WASI_RIGHT_PATH_RENAME_TARGET;
|
|
+ const PATH_FILESTAT_GET = __WASI_RIGHT_PATH_FILESTAT_GET;
|
|
+ const PATH_FILESTAT_SET_SIZE = __WASI_RIGHT_PATH_FILESTAT_SET_SIZE;
|
|
+ const PATH_FILESTAT_SET_TIMES = __WASI_RIGHT_PATH_FILESTAT_SET_TIMES;
|
|
+ const FD_FILESTAT_GET = __WASI_RIGHT_FD_FILESTAT_GET;
|
|
+ const FD_FILESTAT_SET_SIZE = __WASI_RIGHT_FD_FILESTAT_SET_SIZE;
|
|
+ const FD_FILESTAT_SET_TIMES = __WASI_RIGHT_FD_FILESTAT_SET_TIMES;
|
|
+ const PATH_SYMLINK = __WASI_RIGHT_PATH_SYMLINK;
|
|
+ const PATH_REMOVE_DIRECTORY = __WASI_RIGHT_PATH_REMOVE_DIRECTORY;
|
|
+ const PATH_UNLINK_FILE = __WASI_RIGHT_PATH_UNLINK_FILE;
|
|
+ const POLL_FD_READWRITE = __WASI_RIGHT_POLL_FD_READWRITE;
|
|
+ const SOCK_SHUTDOWN = __WASI_RIGHT_SOCK_SHUTDOWN;
|
|
+ }
|
|
+}
|
|
+
|
|
+bitflags! {
|
|
+ pub struct Fstflags: __wasi_fstflags_t {
|
|
+ const SET_ATIM = __WASI_FILESTAT_SET_ATIM;
|
|
+ const SET_ATIM_NOW = __WASI_FILESTAT_SET_ATIM_NOW;
|
|
+ const SET_MTIM = __WASI_FILESTAT_SET_MTIM;
|
|
+ const SET_MTIM_NOW = __WASI_FILESTAT_SET_MTIM_NOW;
|
|
+ }
|
|
+}
|
|
|
|
pub fn clock_res_get(clock_id: Clockid) -> (Errno, Timestamp) {
|
|
let mut resolution = MaybeUninit::<Timestamp>::uninit();
|
|
@@ -333,11 +366,11 @@ pub fn fd_fdstat_get(fd: Fd) -> (Errno, Fdstat) {
|
|
}
|
|
|
|
pub fn fd_fdstat_set_flags(fd: Fd, flags: Fdflags) -> Errno {
|
|
- unsafe { __wasi_fd_fdstat_set_flags(fd, flags) }
|
|
+ unsafe { __wasi_fd_fdstat_set_flags(fd, flags.bits()) }
|
|
}
|
|
|
|
pub fn fd_fdstat_set_rights(fd: Fd, fs_rights_base: Rights, fs_rights_inheriting: Rights) -> Errno {
|
|
- unsafe { __wasi_fd_fdstat_set_rights(fd, fs_rights_base, fs_rights_inheriting) }
|
|
+ unsafe { __wasi_fd_fdstat_set_rights(fd, fs_rights_base.bits(), fs_rights_inheriting.bits()) }
|
|
}
|
|
|
|
pub fn fd_sync(fd: Fd) -> Errno {
|
|
@@ -376,7 +409,7 @@ pub fn path_link(
|
|
unsafe {
|
|
__wasi_path_link(
|
|
old_fd,
|
|
- old_flags,
|
|
+ old_flags.bits(),
|
|
old_path.as_ptr(),
|
|
old_path.len(),
|
|
new_fd,
|
|
@@ -400,13 +433,13 @@ pub fn path_open(
|
|
(
|
|
__wasi_path_open(
|
|
dirfd,
|
|
- dirflags,
|
|
+ dirflags.bits(),
|
|
path.as_ptr(),
|
|
path.len(),
|
|
- oflags,
|
|
- fs_rights_base,
|
|
- fs_rights_inheriting,
|
|
- fs_flags,
|
|
+ oflags.bits(),
|
|
+ fs_rights_base.bits(),
|
|
+ fs_rights_inheriting.bits(),
|
|
+ fs_flags.bits(),
|
|
fd.as_mut_ptr(),
|
|
),
|
|
fd.assume_init(),
|
|
@@ -476,7 +509,7 @@ pub fn fd_filestat_set_times(
|
|
st_mtim: Timestamp,
|
|
fstflags: Fstflags,
|
|
) -> Errno {
|
|
- unsafe { __wasi_fd_filestat_set_times(fd, st_atim, st_mtim, fstflags) }
|
|
+ unsafe { __wasi_fd_filestat_set_times(fd, st_atim, st_mtim, fstflags.bits()) }
|
|
}
|
|
|
|
pub fn fd_filestat_set_size(fd: Fd, st_size: Filesize) -> Errno {
|
|
@@ -487,7 +520,13 @@ pub fn path_filestat_get(fd: Fd, flags: Lookupflags, path: &[u8]) -> (Errno, Fil
|
|
let mut buf = MaybeUninit::<Filestat>::uninit();
|
|
unsafe {
|
|
(
|
|
- __wasi_path_filestat_get(fd, flags, path.as_ptr(), path.len(), buf.as_mut_ptr()),
|
|
+ __wasi_path_filestat_get(
|
|
+ fd,
|
|
+ flags.bits(),
|
|
+ path.as_ptr(),
|
|
+ path.len(),
|
|
+ buf.as_mut_ptr(),
|
|
+ ),
|
|
buf.assume_init(),
|
|
)
|
|
}
|
|
@@ -504,12 +543,12 @@ pub fn path_filestat_set_times(
|
|
unsafe {
|
|
__wasi_path_filestat_set_times(
|
|
fd,
|
|
- flags,
|
|
+ flags.bits(),
|
|
path.as_ptr(),
|
|
path.len(),
|
|
st_atim,
|
|
st_mtim,
|
|
- fstflags,
|
|
+ fstflags.bits(),
|
|
)
|
|
}
|
|
}
|
|
@@ -567,7 +606,7 @@ pub fn sock_recv(sock: Fd, ri_data: &[Iovec], ri_flags: Riflags) -> (Errno, usiz
|
|
sock,
|
|
ri_data.as_ptr(),
|
|
ri_data.len(),
|
|
- ri_flags,
|
|
+ ri_flags.bits(),
|
|
ro_datalen.as_mut_ptr(),
|
|
ro_flags.as_mut_ptr(),
|
|
),
|
|
@@ -594,7 +633,7 @@ pub fn sock_send(sock: Fd, si_data: &[Ciovec], si_flags: Siflags) -> (Errno, usi
|
|
}
|
|
|
|
pub fn sock_shutdown(sock: Fd, how: Sdflags) -> Errno {
|
|
- unsafe { __wasi_sock_shutdown(sock, how) }
|
|
+ unsafe { __wasi_sock_shutdown(sock, how.bits()) }
|
|
}
|
|
|
|
pub fn sched_yield() -> Errno {
|