Add support for wasi_snapshot_preview1. (#592)
* Add support for wasi_snapshot_preview1. This adds support for the new ABI, while preserving compatibility support for the old ABI. * Fix compilation on platforms where nlink_t isn't 64-bit. * rustfmt * Fix Windows build errors.
This commit is contained in:
@@ -8,37 +8,37 @@
|
||||
|
||||
use wig::witx_wasi_types;
|
||||
|
||||
witx_wasi_types!("unstable" "wasi_unstable_preview0");
|
||||
witx_wasi_types!("snapshot" "wasi_snapshot_preview1");
|
||||
|
||||
pub(crate) const RIGHTS_ALL: __wasi_rights_t = __WASI_RIGHT_FD_DATASYNC
|
||||
| __WASI_RIGHT_FD_READ
|
||||
| __WASI_RIGHT_FD_SEEK
|
||||
| __WASI_RIGHT_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHT_FD_SYNC
|
||||
| __WASI_RIGHT_FD_TELL
|
||||
| __WASI_RIGHT_FD_WRITE
|
||||
| __WASI_RIGHT_FD_ADVISE
|
||||
| __WASI_RIGHT_FD_ALLOCATE
|
||||
| __WASI_RIGHT_PATH_CREATE_DIRECTORY
|
||||
| __WASI_RIGHT_PATH_CREATE_FILE
|
||||
| __WASI_RIGHT_PATH_LINK_SOURCE
|
||||
| __WASI_RIGHT_PATH_LINK_TARGET
|
||||
| __WASI_RIGHT_PATH_OPEN
|
||||
| __WASI_RIGHT_FD_READDIR
|
||||
| __WASI_RIGHT_PATH_READLINK
|
||||
| __WASI_RIGHT_PATH_RENAME_SOURCE
|
||||
| __WASI_RIGHT_PATH_RENAME_TARGET
|
||||
| __WASI_RIGHT_PATH_FILESTAT_GET
|
||||
| __WASI_RIGHT_PATH_FILESTAT_SET_SIZE
|
||||
| __WASI_RIGHT_PATH_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHT_FD_FILESTAT_GET
|
||||
| __WASI_RIGHT_FD_FILESTAT_SET_SIZE
|
||||
| __WASI_RIGHT_FD_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHT_PATH_SYMLINK
|
||||
| __WASI_RIGHT_PATH_UNLINK_FILE
|
||||
| __WASI_RIGHT_PATH_REMOVE_DIRECTORY
|
||||
| __WASI_RIGHT_POLL_FD_READWRITE
|
||||
| __WASI_RIGHT_SOCK_SHUTDOWN;
|
||||
pub(crate) const RIGHTS_ALL: __wasi_rights_t = __WASI_RIGHTS_FD_DATASYNC
|
||||
| __WASI_RIGHTS_FD_READ
|
||||
| __WASI_RIGHTS_FD_SEEK
|
||||
| __WASI_RIGHTS_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHTS_FD_SYNC
|
||||
| __WASI_RIGHTS_FD_TELL
|
||||
| __WASI_RIGHTS_FD_WRITE
|
||||
| __WASI_RIGHTS_FD_ADVISE
|
||||
| __WASI_RIGHTS_FD_ALLOCATE
|
||||
| __WASI_RIGHTS_PATH_CREATE_DIRECTORY
|
||||
| __WASI_RIGHTS_PATH_CREATE_FILE
|
||||
| __WASI_RIGHTS_PATH_LINK_SOURCE
|
||||
| __WASI_RIGHTS_PATH_LINK_TARGET
|
||||
| __WASI_RIGHTS_PATH_OPEN
|
||||
| __WASI_RIGHTS_FD_READDIR
|
||||
| __WASI_RIGHTS_PATH_READLINK
|
||||
| __WASI_RIGHTS_PATH_RENAME_SOURCE
|
||||
| __WASI_RIGHTS_PATH_RENAME_TARGET
|
||||
| __WASI_RIGHTS_PATH_FILESTAT_GET
|
||||
| __WASI_RIGHTS_PATH_FILESTAT_SET_SIZE
|
||||
| __WASI_RIGHTS_PATH_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHTS_FD_FILESTAT_GET
|
||||
| __WASI_RIGHTS_FD_FILESTAT_SET_SIZE
|
||||
| __WASI_RIGHTS_FD_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHTS_PATH_SYMLINK
|
||||
| __WASI_RIGHTS_PATH_UNLINK_FILE
|
||||
| __WASI_RIGHTS_PATH_REMOVE_DIRECTORY
|
||||
| __WASI_RIGHTS_POLL_FD_READWRITE
|
||||
| __WASI_RIGHTS_SOCK_SHUTDOWN;
|
||||
|
||||
// Block and character device interaction is outside the scope of
|
||||
// WASI. Simply allow everything.
|
||||
@@ -49,143 +49,143 @@ pub(crate) const RIGHTS_CHARACTER_DEVICE_INHERITING: __wasi_rights_t = RIGHTS_AL
|
||||
|
||||
// Only allow directory operations on directories. Directories can only
|
||||
// yield file descriptors to other directories and files.
|
||||
pub(crate) const RIGHTS_DIRECTORY_BASE: __wasi_rights_t = __WASI_RIGHT_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHT_FD_SYNC
|
||||
| __WASI_RIGHT_FD_ADVISE
|
||||
| __WASI_RIGHT_PATH_CREATE_DIRECTORY
|
||||
| __WASI_RIGHT_PATH_CREATE_FILE
|
||||
| __WASI_RIGHT_PATH_LINK_SOURCE
|
||||
| __WASI_RIGHT_PATH_LINK_TARGET
|
||||
| __WASI_RIGHT_PATH_OPEN
|
||||
| __WASI_RIGHT_FD_READDIR
|
||||
| __WASI_RIGHT_PATH_READLINK
|
||||
| __WASI_RIGHT_PATH_RENAME_SOURCE
|
||||
| __WASI_RIGHT_PATH_RENAME_TARGET
|
||||
| __WASI_RIGHT_PATH_FILESTAT_GET
|
||||
| __WASI_RIGHT_PATH_FILESTAT_SET_SIZE
|
||||
| __WASI_RIGHT_PATH_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHT_FD_FILESTAT_GET
|
||||
| __WASI_RIGHT_FD_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHT_PATH_SYMLINK
|
||||
| __WASI_RIGHT_PATH_UNLINK_FILE
|
||||
| __WASI_RIGHT_PATH_REMOVE_DIRECTORY
|
||||
| __WASI_RIGHT_POLL_FD_READWRITE;
|
||||
pub(crate) const RIGHTS_DIRECTORY_BASE: __wasi_rights_t = __WASI_RIGHTS_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHTS_FD_SYNC
|
||||
| __WASI_RIGHTS_FD_ADVISE
|
||||
| __WASI_RIGHTS_PATH_CREATE_DIRECTORY
|
||||
| __WASI_RIGHTS_PATH_CREATE_FILE
|
||||
| __WASI_RIGHTS_PATH_LINK_SOURCE
|
||||
| __WASI_RIGHTS_PATH_LINK_TARGET
|
||||
| __WASI_RIGHTS_PATH_OPEN
|
||||
| __WASI_RIGHTS_FD_READDIR
|
||||
| __WASI_RIGHTS_PATH_READLINK
|
||||
| __WASI_RIGHTS_PATH_RENAME_SOURCE
|
||||
| __WASI_RIGHTS_PATH_RENAME_TARGET
|
||||
| __WASI_RIGHTS_PATH_FILESTAT_GET
|
||||
| __WASI_RIGHTS_PATH_FILESTAT_SET_SIZE
|
||||
| __WASI_RIGHTS_PATH_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHTS_FD_FILESTAT_GET
|
||||
| __WASI_RIGHTS_FD_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHTS_PATH_SYMLINK
|
||||
| __WASI_RIGHTS_PATH_UNLINK_FILE
|
||||
| __WASI_RIGHTS_PATH_REMOVE_DIRECTORY
|
||||
| __WASI_RIGHTS_POLL_FD_READWRITE;
|
||||
pub(crate) const RIGHTS_DIRECTORY_INHERITING: __wasi_rights_t =
|
||||
RIGHTS_DIRECTORY_BASE | RIGHTS_REGULAR_FILE_BASE;
|
||||
|
||||
// Operations that apply to regular files.
|
||||
pub(crate) const RIGHTS_REGULAR_FILE_BASE: __wasi_rights_t = __WASI_RIGHT_FD_DATASYNC
|
||||
| __WASI_RIGHT_FD_READ
|
||||
| __WASI_RIGHT_FD_SEEK
|
||||
| __WASI_RIGHT_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHT_FD_SYNC
|
||||
| __WASI_RIGHT_FD_TELL
|
||||
| __WASI_RIGHT_FD_WRITE
|
||||
| __WASI_RIGHT_FD_ADVISE
|
||||
| __WASI_RIGHT_FD_ALLOCATE
|
||||
| __WASI_RIGHT_FD_FILESTAT_GET
|
||||
| __WASI_RIGHT_FD_FILESTAT_SET_SIZE
|
||||
| __WASI_RIGHT_FD_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHT_POLL_FD_READWRITE;
|
||||
pub(crate) const RIGHTS_REGULAR_FILE_BASE: __wasi_rights_t = __WASI_RIGHTS_FD_DATASYNC
|
||||
| __WASI_RIGHTS_FD_READ
|
||||
| __WASI_RIGHTS_FD_SEEK
|
||||
| __WASI_RIGHTS_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHTS_FD_SYNC
|
||||
| __WASI_RIGHTS_FD_TELL
|
||||
| __WASI_RIGHTS_FD_WRITE
|
||||
| __WASI_RIGHTS_FD_ADVISE
|
||||
| __WASI_RIGHTS_FD_ALLOCATE
|
||||
| __WASI_RIGHTS_FD_FILESTAT_GET
|
||||
| __WASI_RIGHTS_FD_FILESTAT_SET_SIZE
|
||||
| __WASI_RIGHTS_FD_FILESTAT_SET_TIMES
|
||||
| __WASI_RIGHTS_POLL_FD_READWRITE;
|
||||
pub(crate) const RIGHTS_REGULAR_FILE_INHERITING: __wasi_rights_t = 0;
|
||||
|
||||
// Operations that apply to sockets and socket pairs.
|
||||
pub(crate) const RIGHTS_SOCKET_BASE: __wasi_rights_t = __WASI_RIGHT_FD_READ
|
||||
| __WASI_RIGHT_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHT_FD_WRITE
|
||||
| __WASI_RIGHT_FD_FILESTAT_GET
|
||||
| __WASI_RIGHT_POLL_FD_READWRITE
|
||||
| __WASI_RIGHT_SOCK_SHUTDOWN;
|
||||
pub(crate) const RIGHTS_SOCKET_BASE: __wasi_rights_t = __WASI_RIGHTS_FD_READ
|
||||
| __WASI_RIGHTS_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHTS_FD_WRITE
|
||||
| __WASI_RIGHTS_FD_FILESTAT_GET
|
||||
| __WASI_RIGHTS_POLL_FD_READWRITE
|
||||
| __WASI_RIGHTS_SOCK_SHUTDOWN;
|
||||
pub(crate) const RIGHTS_SOCKET_INHERITING: __wasi_rights_t = RIGHTS_ALL;
|
||||
|
||||
// Operations that apply to TTYs.
|
||||
pub(crate) const RIGHTS_TTY_BASE: __wasi_rights_t = __WASI_RIGHT_FD_READ
|
||||
| __WASI_RIGHT_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHT_FD_WRITE
|
||||
| __WASI_RIGHT_FD_FILESTAT_GET
|
||||
| __WASI_RIGHT_POLL_FD_READWRITE;
|
||||
pub(crate) const RIGHTS_TTY_BASE: __wasi_rights_t = __WASI_RIGHTS_FD_READ
|
||||
| __WASI_RIGHTS_FD_FDSTAT_SET_FLAGS
|
||||
| __WASI_RIGHTS_FD_WRITE
|
||||
| __WASI_RIGHTS_FD_FILESTAT_GET
|
||||
| __WASI_RIGHTS_POLL_FD_READWRITE;
|
||||
#[allow(unused)]
|
||||
pub(crate) const RIGHTS_TTY_INHERITING: __wasi_rights_t = 0;
|
||||
|
||||
pub fn strerror(errno: __wasi_errno_t) -> &'static str {
|
||||
match errno {
|
||||
__WASI_ESUCCESS => "__WASI_ESUCCESS",
|
||||
__WASI_E2BIG => "__WASI_E2BIG",
|
||||
__WASI_EACCES => "__WASI_EACCES",
|
||||
__WASI_EADDRINUSE => "__WASI_EADDRINUSE",
|
||||
__WASI_EADDRNOTAVAIL => "__WASI_EADDRNOTAVAIL",
|
||||
__WASI_EAFNOSUPPORT => "__WASI_EAFNOSUPPORT",
|
||||
__WASI_EAGAIN => "__WASI_EAGAIN",
|
||||
__WASI_EALREADY => "__WASI_EALREADY",
|
||||
__WASI_EBADF => "__WASI_EBADF",
|
||||
__WASI_EBADMSG => "__WASI_EBADMSG",
|
||||
__WASI_EBUSY => "__WASI_EBUSY",
|
||||
__WASI_ECANCELED => "__WASI_ECANCELED",
|
||||
__WASI_ECHILD => "__WASI_ECHILD",
|
||||
__WASI_ECONNABORTED => "__WASI_ECONNABORTED",
|
||||
__WASI_ECONNREFUSED => "__WASI_ECONNREFUSED",
|
||||
__WASI_ECONNRESET => "__WASI_ECONNRESET",
|
||||
__WASI_EDEADLK => "__WASI_EDEADLK",
|
||||
__WASI_EDESTADDRREQ => "__WASI_EDESTADDRREQ",
|
||||
__WASI_EDOM => "__WASI_EDOM",
|
||||
__WASI_EDQUOT => "__WASI_EDQUOT",
|
||||
__WASI_EEXIST => "__WASI_EEXIST",
|
||||
__WASI_EFAULT => "__WASI_EFAULT",
|
||||
__WASI_EFBIG => "__WASI_EFBIG",
|
||||
__WASI_EHOSTUNREACH => "__WASI_EHOSTUNREACH",
|
||||
__WASI_EIDRM => "__WASI_EIDRM",
|
||||
__WASI_EILSEQ => "__WASI_EILSEQ",
|
||||
__WASI_EINPROGRESS => "__WASI_EINPROGRESS",
|
||||
__WASI_EINTR => "__WASI_EINTR",
|
||||
__WASI_EINVAL => "__WASI_EINVAL",
|
||||
__WASI_EIO => "__WASI_EIO",
|
||||
__WASI_EISCONN => "__WASI_EISCONN",
|
||||
__WASI_EISDIR => "__WASI_EISDIR",
|
||||
__WASI_ELOOP => "__WASI_ELOOP",
|
||||
__WASI_EMFILE => "__WASI_EMFILE",
|
||||
__WASI_EMLINK => "__WASI_EMLINK",
|
||||
__WASI_EMSGSIZE => "__WASI_EMSGSIZE",
|
||||
__WASI_EMULTIHOP => "__WASI_EMULTIHOP",
|
||||
__WASI_ENAMETOOLONG => "__WASI_ENAMETOOLONG",
|
||||
__WASI_ENETDOWN => "__WASI_ENETDOWN",
|
||||
__WASI_ENETRESET => "__WASI_ENETRESET",
|
||||
__WASI_ENETUNREACH => "__WASI_ENETUNREACH",
|
||||
__WASI_ENFILE => "__WASI_ENFILE",
|
||||
__WASI_ENOBUFS => "__WASI_ENOBUFS",
|
||||
__WASI_ENODEV => "__WASI_ENODEV",
|
||||
__WASI_ENOENT => "__WASI_ENOENT",
|
||||
__WASI_ENOEXEC => "__WASI_ENOEXEC",
|
||||
__WASI_ENOLCK => "__WASI_ENOLCK",
|
||||
__WASI_ENOLINK => "__WASI_ENOLINK",
|
||||
__WASI_ENOMEM => "__WASI_ENOMEM",
|
||||
__WASI_ENOMSG => "__WASI_ENOMSG",
|
||||
__WASI_ENOPROTOOPT => "__WASI_ENOPROTOOPT",
|
||||
__WASI_ENOSPC => "__WASI_ENOSPC",
|
||||
__WASI_ENOSYS => "__WASI_ENOSYS",
|
||||
__WASI_ENOTCONN => "__WASI_ENOTCONN",
|
||||
__WASI_ENOTDIR => "__WASI_ENOTDIR",
|
||||
__WASI_ENOTEMPTY => "__WASI_ENOTEMPTY",
|
||||
__WASI_ENOTRECOVERABLE => "__WASI_ENOTRECOVERABLE",
|
||||
__WASI_ENOTSOCK => "__WASI_ENOTSOCK",
|
||||
__WASI_ENOTSUP => "__WASI_ENOTSUP",
|
||||
__WASI_ENOTTY => "__WASI_ENOTTY",
|
||||
__WASI_ENXIO => "__WASI_ENXIO",
|
||||
__WASI_EOVERFLOW => "__WASI_EOVERFLOW",
|
||||
__WASI_EOWNERDEAD => "__WASI_EOWNERDEAD",
|
||||
__WASI_EPERM => "__WASI_EPERM",
|
||||
__WASI_EPIPE => "__WASI_EPIPE",
|
||||
__WASI_EPROTO => "__WASI_EPROTO",
|
||||
__WASI_EPROTONOSUPPORT => "__WASI_EPROTONOSUPPORT",
|
||||
__WASI_EPROTOTYPE => "__WASI_EPROTOTYPE",
|
||||
__WASI_ERANGE => "__WASI_ERANGE",
|
||||
__WASI_EROFS => "__WASI_EROFS",
|
||||
__WASI_ESPIPE => "__WASI_ESPIPE",
|
||||
__WASI_ESRCH => "__WASI_ESRCH",
|
||||
__WASI_ESTALE => "__WASI_ESTALE",
|
||||
__WASI_ETIMEDOUT => "__WASI_ETIMEDOUT",
|
||||
__WASI_ETXTBSY => "__WASI_ETXTBSY",
|
||||
__WASI_EXDEV => "__WASI_EXDEV",
|
||||
__WASI_ENOTCAPABLE => "__WASI_ENOTCAPABLE",
|
||||
__WASI_ERRNO_SUCCESS => "__WASI_ERRNO_SUCCESS",
|
||||
__WASI_ERRNO_2BIG => "__WASI_ERRNO_2BIG",
|
||||
__WASI_ERRNO_ACCES => "__WASI_ERRNO_ACCES",
|
||||
__WASI_ERRNO_ADDRINUSE => "__WASI_ERRNO_ADDRINUSE",
|
||||
__WASI_ERRNO_ADDRNOTAVAIL => "__WASI_ERRNO_ADDRNOTAVAIL",
|
||||
__WASI_ERRNO_AFNOSUPPORT => "__WASI_ERRNO_AFNOSUPPORT",
|
||||
__WASI_ERRNO_AGAIN => "__WASI_ERRNO_AGAIN",
|
||||
__WASI_ERRNO_ALREADY => "__WASI_ERRNO_ALREADY",
|
||||
__WASI_ERRNO_BADF => "__WASI_ERRNO_BADF",
|
||||
__WASI_ERRNO_BADMSG => "__WASI_ERRNO_BADMSG",
|
||||
__WASI_ERRNO_BUSY => "__WASI_ERRNO_BUSY",
|
||||
__WASI_ERRNO_CANCELED => "__WASI_ERRNO_CANCELED",
|
||||
__WASI_ERRNO_CHILD => "__WASI_ERRNO_CHILD",
|
||||
__WASI_ERRNO_CONNABORTED => "__WASI_ERRNO_CONNABORTED",
|
||||
__WASI_ERRNO_CONNREFUSED => "__WASI_ERRNO_CONNREFUSED",
|
||||
__WASI_ERRNO_CONNRESET => "__WASI_ERRNO_CONNRESET",
|
||||
__WASI_ERRNO_DEADLK => "__WASI_ERRNO_DEADLK",
|
||||
__WASI_ERRNO_DESTADDRREQ => "__WASI_ERRNO_DESTADDRREQ",
|
||||
__WASI_ERRNO_DOM => "__WASI_ERRNO_DOM",
|
||||
__WASI_ERRNO_DQUOT => "__WASI_ERRNO_DQUOT",
|
||||
__WASI_ERRNO_EXIST => "__WASI_ERRNO_EXIST",
|
||||
__WASI_ERRNO_FAULT => "__WASI_ERRNO_FAULT",
|
||||
__WASI_ERRNO_FBIG => "__WASI_ERRNO_FBIG",
|
||||
__WASI_ERRNO_HOSTUNREACH => "__WASI_ERRNO_HOSTUNREACH",
|
||||
__WASI_ERRNO_IDRM => "__WASI_ERRNO_IDRM",
|
||||
__WASI_ERRNO_ILSEQ => "__WASI_ERRNO_ILSEQ",
|
||||
__WASI_ERRNO_INPROGRESS => "__WASI_ERRNO_INPROGRESS",
|
||||
__WASI_ERRNO_INTR => "__WASI_ERRNO_INTR",
|
||||
__WASI_ERRNO_INVAL => "__WASI_ERRNO_INVAL",
|
||||
__WASI_ERRNO_IO => "__WASI_ERRNO_IO",
|
||||
__WASI_ERRNO_ISCONN => "__WASI_ERRNO_ISCONN",
|
||||
__WASI_ERRNO_ISDIR => "__WASI_ERRNO_ISDIR",
|
||||
__WASI_ERRNO_LOOP => "__WASI_ERRNO_LOOP",
|
||||
__WASI_ERRNO_MFILE => "__WASI_ERRNO_MFILE",
|
||||
__WASI_ERRNO_MLINK => "__WASI_ERRNO_MLINK",
|
||||
__WASI_ERRNO_MSGSIZE => "__WASI_ERRNO_MSGSIZE",
|
||||
__WASI_ERRNO_MULTIHOP => "__WASI_ERRNO_MULTIHOP",
|
||||
__WASI_ERRNO_NAMETOOLONG => "__WASI_ERRNO_NAMETOOLONG",
|
||||
__WASI_ERRNO_NETDOWN => "__WASI_ERRNO_NETDOWN",
|
||||
__WASI_ERRNO_NETRESET => "__WASI_ERRNO_NETRESET",
|
||||
__WASI_ERRNO_NETUNREACH => "__WASI_ERRNO_NETUNREACH",
|
||||
__WASI_ERRNO_NFILE => "__WASI_ERRNO_NFILE",
|
||||
__WASI_ERRNO_NOBUFS => "__WASI_ERRNO_NOBUFS",
|
||||
__WASI_ERRNO_NODEV => "__WASI_ERRNO_NODEV",
|
||||
__WASI_ERRNO_NOENT => "__WASI_ERRNO_NOENT",
|
||||
__WASI_ERRNO_NOEXEC => "__WASI_ERRNO_NOEXEC",
|
||||
__WASI_ERRNO_NOLCK => "__WASI_ERRNO_NOLCK",
|
||||
__WASI_ERRNO_NOLINK => "__WASI_ERRNO_NOLINK",
|
||||
__WASI_ERRNO_NOMEM => "__WASI_ERRNO_NOMEM",
|
||||
__WASI_ERRNO_NOMSG => "__WASI_ERRNO_NOMSG",
|
||||
__WASI_ERRNO_NOPROTOOPT => "__WASI_ERRNO_NOPROTOOPT",
|
||||
__WASI_ERRNO_NOSPC => "__WASI_ERRNO_NOSPC",
|
||||
__WASI_ERRNO_NOSYS => "__WASI_ERRNO_NOSYS",
|
||||
__WASI_ERRNO_NOTCONN => "__WASI_ERRNO_NOTCONN",
|
||||
__WASI_ERRNO_NOTDIR => "__WASI_ERRNO_NOTDIR",
|
||||
__WASI_ERRNO_NOTEMPTY => "__WASI_ERRNO_NOTEMPTY",
|
||||
__WASI_ERRNO_NOTRECOVERABLE => "__WASI_ERRNO_NOTRECOVERABLE",
|
||||
__WASI_ERRNO_NOTSOCK => "__WASI_ERRNO_NOTSOCK",
|
||||
__WASI_ERRNO_NOTSUP => "__WASI_ERRNO_NOTSUP",
|
||||
__WASI_ERRNO_NOTTY => "__WASI_ERRNO_NOTTY",
|
||||
__WASI_ERRNO_NXIO => "__WASI_ERRNO_NXIO",
|
||||
__WASI_ERRNO_OVERFLOW => "__WASI_ERRNO_OVERFLOW",
|
||||
__WASI_ERRNO_OWNERDEAD => "__WASI_ERRNO_OWNERDEAD",
|
||||
__WASI_ERRNO_PERM => "__WASI_ERRNO_PERM",
|
||||
__WASI_ERRNO_PIPE => "__WASI_ERRNO_PIPE",
|
||||
__WASI_ERRNO_PROTO => "__WASI_ERRNO_PROTO",
|
||||
__WASI_ERRNO_PROTONOSUPPORT => "__WASI_ERRNO_PROTONOSUPPORT",
|
||||
__WASI_ERRNO_PROTOTYPE => "__WASI_ERRNO_PROTOTYPE",
|
||||
__WASI_ERRNO_RANGE => "__WASI_ERRNO_RANGE",
|
||||
__WASI_ERRNO_ROFS => "__WASI_ERRNO_ROFS",
|
||||
__WASI_ERRNO_SPIPE => "__WASI_ERRNO_SPIPE",
|
||||
__WASI_ERRNO_SRCH => "__WASI_ERRNO_SRCH",
|
||||
__WASI_ERRNO_STALE => "__WASI_ERRNO_STALE",
|
||||
__WASI_ERRNO_TIMEDOUT => "__WASI_ERRNO_TIMEDOUT",
|
||||
__WASI_ERRNO_TXTBSY => "__WASI_ERRNO_TXTBSY",
|
||||
__WASI_ERRNO_XDEV => "__WASI_ERRNO_XDEV",
|
||||
__WASI_ERRNO_NOTCAPABLE => "__WASI_ERRNO_NOTCAPABLE",
|
||||
other => panic!("Undefined errno value {:?}", other),
|
||||
}
|
||||
}
|
||||
@@ -295,21 +295,23 @@ mod test {
|
||||
#[test]
|
||||
fn bindgen_test_layout___wasi_event_t___wasi_event_u() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_event_u>(),
|
||||
::std::mem::size_of::<__wasi_event_u_t>(),
|
||||
16usize,
|
||||
concat!("Size of: ", stringify!(__wasi_event_u))
|
||||
concat!("Size of: ", stringify!(__wasi_event_u_t))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<__wasi_event_u>(),
|
||||
::std::mem::align_of::<__wasi_event_u_t>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(__wasi_event_u))
|
||||
concat!("Alignment of ", stringify!(__wasi_event_u_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_event_u>())).fd_readwrite as *const _ as usize },
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_event_u_t>())).fd_readwrite as *const _ as usize
|
||||
},
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_event_u),
|
||||
stringify!(__wasi_event_u_t),
|
||||
"::",
|
||||
stringify!(fd_readwrite)
|
||||
)
|
||||
@@ -467,11 +469,11 @@ mod test {
|
||||
fn bindgen_test_layout_wasi_filestat_t() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_filestat_t>(),
|
||||
56usize,
|
||||
64usize,
|
||||
concat!("Size of: ", stringify!(__wasi_filestat_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_dev as *const _ as usize },
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).dev as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
@@ -481,7 +483,7 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_ino as *const _ as usize },
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).ino as *const _ as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
@@ -491,9 +493,7 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_filestat_t>())).st_filetype as *const _ as usize
|
||||
},
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).filetype as *const _ as usize },
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
@@ -503,8 +503,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_nlink as *const _ as usize },
|
||||
20usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).nlink as *const _ as usize },
|
||||
24usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
@@ -513,8 +513,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_size as *const _ as usize },
|
||||
24usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).size as *const _ as usize },
|
||||
32usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
@@ -523,8 +523,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_atim as *const _ as usize },
|
||||
32usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).atim as *const _ as usize },
|
||||
40usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
@@ -533,8 +533,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_mtim as *const _ as usize },
|
||||
40usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).mtim as *const _ as usize },
|
||||
48usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
@@ -543,8 +543,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_ctim as *const _ as usize },
|
||||
48usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).ctim as *const _ as usize },
|
||||
56usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
@@ -558,7 +558,7 @@ mod test {
|
||||
fn bindgen_test_layout___wasi_subscription_clock_t() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_subscription_clock_t>(),
|
||||
40usize,
|
||||
32usize,
|
||||
concat!("Size of: ", stringify!(__wasi_subscription_clock_t))
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -568,23 +568,9 @@ mod test {
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_subscription_clock_t>())).identifier as *const _
|
||||
as usize
|
||||
&(*(::std::ptr::null::<__wasi_subscription_clock_t>())).id as *const _ as usize
|
||||
},
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_subscription_clock_t),
|
||||
"::",
|
||||
stringify!(identifier)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_subscription_clock_t>())).clock_id as *const _
|
||||
as usize
|
||||
},
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_subscription_clock_t),
|
||||
@@ -596,7 +582,7 @@ mod test {
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_subscription_clock_t>())).timeout as *const _ as usize
|
||||
},
|
||||
16usize,
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_subscription_clock_t),
|
||||
@@ -609,7 +595,7 @@ mod test {
|
||||
&(*(::std::ptr::null::<__wasi_subscription_clock_t>())).precision as *const _
|
||||
as usize
|
||||
},
|
||||
24usize,
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_subscription_clock_t),
|
||||
@@ -621,7 +607,7 @@ mod test {
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_subscription_clock_t>())).flags as *const _ as usize
|
||||
},
|
||||
32usize,
|
||||
24usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_subscription_clock_t),
|
||||
@@ -665,33 +651,36 @@ mod test {
|
||||
#[test]
|
||||
fn bindgen_test_layout___wasi_subscription_t___wasi_subscription_u() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_subscription_u>(),
|
||||
40usize,
|
||||
concat!("Size of: ", stringify!(__wasi_subscription_u))
|
||||
::std::mem::size_of::<__wasi_subscription_u_t>(),
|
||||
32usize,
|
||||
concat!("Size of: ", stringify!(__wasi_subscription_u_t))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<__wasi_subscription_u>(),
|
||||
::std::mem::align_of::<__wasi_subscription_u_t>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(__wasi_subscription_u))
|
||||
concat!("Alignment of ", stringify!(__wasi_subscription_u_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_subscription_u>())).clock as *const _ as usize },
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_subscription_u_t>())).clock as *const _ as usize
|
||||
},
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_subscription_u),
|
||||
stringify!(__wasi_subscription_u_t),
|
||||
"::",
|
||||
stringify!(clock)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_subscription_u>())).fd_readwrite as *const _ as usize
|
||||
&(*(::std::ptr::null::<__wasi_subscription_u_t>())).fd_readwrite as *const _
|
||||
as usize
|
||||
},
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_subscription_u),
|
||||
stringify!(__wasi_subscription_u_t),
|
||||
"::",
|
||||
stringify!(fd_readwrite)
|
||||
)
|
||||
@@ -702,7 +691,7 @@ mod test {
|
||||
fn bindgen_test_layout___wasi_subscription_t() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_subscription_t>(),
|
||||
56usize,
|
||||
48usize,
|
||||
concat!("Size of: ", stringify!(__wasi_subscription_t))
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -750,7 +739,7 @@ mod test {
|
||||
fn bindgen_test_layout___wasi_filestat_t() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<__wasi_filestat_t>(),
|
||||
56usize,
|
||||
64usize,
|
||||
concat!("Size of: ", stringify!(__wasi_filestat_t))
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -759,7 +748,7 @@ mod test {
|
||||
concat!("Alignment of ", stringify!(__wasi_filestat_t))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_dev as *const _ as usize },
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).dev as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
@@ -769,7 +758,7 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_ino as *const _ as usize },
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).ino as *const _ as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
@@ -779,9 +768,7 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe {
|
||||
&(*(::std::ptr::null::<__wasi_filestat_t>())).st_filetype as *const _ as usize
|
||||
},
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).filetype as *const _ as usize },
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
@@ -791,8 +778,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_nlink as *const _ as usize },
|
||||
20usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).nlink as *const _ as usize },
|
||||
24usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
@@ -801,8 +788,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_size as *const _ as usize },
|
||||
24usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).size as *const _ as usize },
|
||||
32usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
@@ -811,8 +798,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_atim as *const _ as usize },
|
||||
32usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).atim as *const _ as usize },
|
||||
40usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
@@ -821,8 +808,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_mtim as *const _ as usize },
|
||||
40usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).mtim as *const _ as usize },
|
||||
48usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
@@ -831,8 +818,8 @@ mod test {
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).st_ctim as *const _ as usize },
|
||||
48usize,
|
||||
unsafe { &(*(::std::ptr::null::<__wasi_filestat_t>())).ctim as *const _ as usize },
|
||||
56usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(__wasi_filestat_t),
|
||||
|
||||
Reference in New Issue
Block a user