Port host::__wasi_errno_t errors to Rust
They are now blacklisted in the bindgen.
This commit is contained in:
@@ -20,6 +20,7 @@ target-lexicon = "0.3.0"
|
|||||||
cast = { version = "0.2.2", default-features = false }
|
cast = { version = "0.2.2", default-features = false }
|
||||||
log = { version = "0.4.6", default-features = false }
|
log = { version = "0.4.6", default-features = false }
|
||||||
libc = "0.2.50"
|
libc = "0.2.50"
|
||||||
|
errno = "0.2.4"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cmake = "0.1.35"
|
cmake = "0.1.35"
|
||||||
|
|||||||
@@ -24,7 +24,84 @@ fn main() {
|
|||||||
.whitelist_type("fd_table")
|
.whitelist_type("fd_table")
|
||||||
.whitelist_type("fd_prestats")
|
.whitelist_type("fd_prestats")
|
||||||
.whitelist_type("argv_environ_values")
|
.whitelist_type("argv_environ_values")
|
||||||
.whitelist_var("__WASI_.*");
|
.whitelist_var("__WASI_.*")
|
||||||
|
.blacklist_item("__WASI_ESUCCESS")
|
||||||
|
.blacklist_item("__WASI_E2BIG")
|
||||||
|
.blacklist_item("__WASI_EACCES")
|
||||||
|
.blacklist_item("__WASI_EADDRINUSE")
|
||||||
|
.blacklist_item("__WASI_EADDRNOTAVAIL")
|
||||||
|
.blacklist_item("__WASI_EAFNOSUPPORT")
|
||||||
|
.blacklist_item("__WASI_EAGAIN")
|
||||||
|
.blacklist_item("__WASI_EALREADY")
|
||||||
|
.blacklist_item("__WASI_EBADF")
|
||||||
|
.blacklist_item("__WASI_EBADMSG")
|
||||||
|
.blacklist_item("__WASI_EBUSY")
|
||||||
|
.blacklist_item("__WASI_ECANCELED")
|
||||||
|
.blacklist_item("__WASI_ECHILD")
|
||||||
|
.blacklist_item("__WASI_ECONNABORTED")
|
||||||
|
.blacklist_item("__WASI_ECONNREFUSED")
|
||||||
|
.blacklist_item("__WASI_ECONNRESET")
|
||||||
|
.blacklist_item("__WASI_EDEADLK")
|
||||||
|
.blacklist_item("__WASI_EDESTADDRREQ")
|
||||||
|
.blacklist_item("__WASI_EDOM")
|
||||||
|
.blacklist_item("__WASI_EDQUOT")
|
||||||
|
.blacklist_item("__WASI_EEXIST")
|
||||||
|
.blacklist_item("__WASI_EFAULT")
|
||||||
|
.blacklist_item("__WASI_EFBIG")
|
||||||
|
.blacklist_item("__WASI_EHOSTUNREACH")
|
||||||
|
.blacklist_item("__WASI_EIDRM")
|
||||||
|
.blacklist_item("__WASI_EILSEQ")
|
||||||
|
.blacklist_item("__WASI_EINPROGRESS")
|
||||||
|
.blacklist_item("__WASI_EINTR")
|
||||||
|
.blacklist_item("__WASI_EINVAL")
|
||||||
|
.blacklist_item("__WASI_EIO")
|
||||||
|
.blacklist_item("__WASI_EISCONN")
|
||||||
|
.blacklist_item("__WASI_EISDIR")
|
||||||
|
.blacklist_item("__WASI_ELOOP")
|
||||||
|
.blacklist_item("__WASI_EMFILE")
|
||||||
|
.blacklist_item("__WASI_EMLINK")
|
||||||
|
.blacklist_item("__WASI_EMSGSIZE")
|
||||||
|
.blacklist_item("__WASI_EMULTIHOP")
|
||||||
|
.blacklist_item("__WASI_ENAMETOOLONG")
|
||||||
|
.blacklist_item("__WASI_ENETDOWN")
|
||||||
|
.blacklist_item("__WASI_ENETRESET")
|
||||||
|
.blacklist_item("__WASI_ENETUNREACH")
|
||||||
|
.blacklist_item("__WASI_ENFILE")
|
||||||
|
.blacklist_item("__WASI_ENOBUFS")
|
||||||
|
.blacklist_item("__WASI_ENODEV")
|
||||||
|
.blacklist_item("__WASI_ENOENT")
|
||||||
|
.blacklist_item("__WASI_ENOEXEC")
|
||||||
|
.blacklist_item("__WASI_ENOLCK")
|
||||||
|
.blacklist_item("__WASI_ENOLINK")
|
||||||
|
.blacklist_item("__WASI_ENOMEM")
|
||||||
|
.blacklist_item("__WASI_ENOMSG")
|
||||||
|
.blacklist_item("__WASI_ENOPROTOOPT")
|
||||||
|
.blacklist_item("__WASI_ENOSPC")
|
||||||
|
.blacklist_item("__WASI_ENOSYS")
|
||||||
|
.blacklist_item("__WASI_ENOTCONN")
|
||||||
|
.blacklist_item("__WASI_ENOTDIR")
|
||||||
|
.blacklist_item("__WASI_ENOTEMPTY")
|
||||||
|
.blacklist_item("__WASI_ENOTRECOVERABLE")
|
||||||
|
.blacklist_item("__WASI_ENOTSOCK")
|
||||||
|
.blacklist_item("__WASI_ENOTSUP")
|
||||||
|
.blacklist_item("__WASI_ENOTTY")
|
||||||
|
.blacklist_item("__WASI_ENXIO")
|
||||||
|
.blacklist_item("__WASI_EOVERFLOW")
|
||||||
|
.blacklist_item("__WASI_EOWNERDEAD")
|
||||||
|
.blacklist_item("__WASI_EPERM")
|
||||||
|
.blacklist_item("__WASI_EPIPE")
|
||||||
|
.blacklist_item("__WASI_EPROTO")
|
||||||
|
.blacklist_item("__WASI_EPROTONOSUPPORT")
|
||||||
|
.blacklist_item("__WASI_EPROTOTYPE")
|
||||||
|
.blacklist_item("__WASI_ERANGE")
|
||||||
|
.blacklist_item("__WASI_EROFS")
|
||||||
|
.blacklist_item("__WASI_ESPIPE")
|
||||||
|
.blacklist_item("__WASI_ESRCH")
|
||||||
|
.blacklist_item("__WASI_ESTALE")
|
||||||
|
.blacklist_item("__WASI_ETIMEDOUT")
|
||||||
|
.blacklist_item("__WASI_ETXTBSY")
|
||||||
|
.blacklist_item("__WASI_EXDEV")
|
||||||
|
.blacklist_item("__WASI_ENOTCAPABLE");
|
||||||
|
|
||||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||||
|
|
||||||
|
|||||||
@@ -4,134 +4,82 @@ include!(concat!(env!("OUT_DIR"), "/wasmtime_ssp.rs"));
|
|||||||
|
|
||||||
pub type char = ::std::os::raw::c_char;
|
pub type char = ::std::os::raw::c_char;
|
||||||
pub type void = ::std::os::raw::c_void;
|
pub type void = ::std::os::raw::c_void;
|
||||||
|
// pub type __wasi_errno_t = u16;
|
||||||
|
|
||||||
use super::wasm32;
|
pub const __WASI_ESUCCESS: __wasi_errno_t = 0;
|
||||||
|
pub const __WASI_E2BIG: __wasi_errno_t = 1;
|
||||||
// Taken from rust's implementation of `std::os` functionality for unix systems
|
pub const __WASI_EACCES: __wasi_errno_t = 2;
|
||||||
// rust/src/libstd/sys/unix/os.rs
|
pub const __WASI_EADDRINUSE: __wasi_errno_t = 3;
|
||||||
// https://github.com/rust-lang/rust/blob/9ebf47851a357faa4cd97f4b1dc7835f6376e639/src/libstd/sys/unix/os.rs
|
pub const __WASI_EADDRNOTAVAIL: __wasi_errno_t = 4;
|
||||||
extern "C" {
|
pub const __WASI_EAFNOSUPPORT: __wasi_errno_t = 5;
|
||||||
#[cfg(not(target_os = "dragonfly"))]
|
pub const __WASI_EAGAIN: __wasi_errno_t = 6;
|
||||||
#[cfg_attr(
|
pub const __WASI_EALREADY: __wasi_errno_t = 7;
|
||||||
any(target_os = "linux", target_os = "fuchsia", target_os = "l4re"),
|
pub const __WASI_EBADF: __wasi_errno_t = 8;
|
||||||
link_name = "__errno_location"
|
pub const __WASI_EBADMSG: __wasi_errno_t = 9;
|
||||||
)]
|
pub const __WASI_EBUSY: __wasi_errno_t = 10;
|
||||||
#[cfg_attr(
|
pub const __WASI_ECANCELED: __wasi_errno_t = 11;
|
||||||
any(
|
pub const __WASI_ECHILD: __wasi_errno_t = 12;
|
||||||
target_os = "bitrig",
|
pub const __WASI_ECONNABORTED: __wasi_errno_t = 13;
|
||||||
target_os = "netbsd",
|
pub const __WASI_ECONNREFUSED: __wasi_errno_t = 14;
|
||||||
target_os = "openbsd",
|
pub const __WASI_ECONNRESET: __wasi_errno_t = 15;
|
||||||
target_os = "android",
|
pub const __WASI_EDEADLK: __wasi_errno_t = 16;
|
||||||
target_os = "hermit",
|
pub const __WASI_EDESTADDRREQ: __wasi_errno_t = 17;
|
||||||
target_env = "newlib"
|
pub const __WASI_EDOM: __wasi_errno_t = 18;
|
||||||
),
|
pub const __WASI_EDQUOT: __wasi_errno_t = 19;
|
||||||
link_name = "__errno"
|
pub const __WASI_EEXIST: __wasi_errno_t = 20;
|
||||||
)]
|
pub const __WASI_EFAULT: __wasi_errno_t = 21;
|
||||||
#[cfg_attr(target_os = "solaris", link_name = "___errno")]
|
pub const __WASI_EFBIG: __wasi_errno_t = 22;
|
||||||
#[cfg_attr(
|
pub const __WASI_EHOSTUNREACH: __wasi_errno_t = 23;
|
||||||
any(target_os = "macos", target_os = "ios", target_os = "freebsd"),
|
pub const __WASI_EIDRM: __wasi_errno_t = 24;
|
||||||
link_name = "__error"
|
pub const __WASI_EILSEQ: __wasi_errno_t = 25;
|
||||||
)]
|
pub const __WASI_EINPROGRESS: __wasi_errno_t = 26;
|
||||||
#[cfg_attr(target_os = "haiku", link_name = "_errnop")]
|
pub const __WASI_EINTR: __wasi_errno_t = 27;
|
||||||
fn errno_location() -> *mut libc::c_int;
|
pub const __WASI_EINVAL: __wasi_errno_t = 28;
|
||||||
}
|
pub const __WASI_EIO: __wasi_errno_t = 29;
|
||||||
|
pub const __WASI_EISCONN: __wasi_errno_t = 30;
|
||||||
#[cfg(not(target_os = "dragonfly"))]
|
pub const __WASI_EISDIR: __wasi_errno_t = 31;
|
||||||
pub fn errno() -> i32 {
|
pub const __WASI_ELOOP: __wasi_errno_t = 32;
|
||||||
unsafe { (*errno_location()) as i32 }
|
pub const __WASI_EMFILE: __wasi_errno_t = 33;
|
||||||
}
|
pub const __WASI_EMLINK: __wasi_errno_t = 34;
|
||||||
|
pub const __WASI_EMSGSIZE: __wasi_errno_t = 35;
|
||||||
#[cfg(target_os = "dragonfly")]
|
pub const __WASI_EMULTIHOP: __wasi_errno_t = 36;
|
||||||
pub fn errno() -> i32 {
|
pub const __WASI_ENAMETOOLONG: __wasi_errno_t = 37;
|
||||||
extern "C" {
|
pub const __WASI_ENETDOWN: __wasi_errno_t = 38;
|
||||||
#[thread_local]
|
pub const __WASI_ENETRESET: __wasi_errno_t = 39;
|
||||||
static errno: c_int;
|
pub const __WASI_ENETUNREACH: __wasi_errno_t = 40;
|
||||||
}
|
pub const __WASI_ENFILE: __wasi_errno_t = 41;
|
||||||
|
pub const __WASI_ENOBUFS: __wasi_errno_t = 42;
|
||||||
unsafe { errno as i32 }
|
pub const __WASI_ENODEV: __wasi_errno_t = 43;
|
||||||
}
|
pub const __WASI_ENOENT: __wasi_errno_t = 44;
|
||||||
|
pub const __WASI_ENOEXEC: __wasi_errno_t = 45;
|
||||||
pub fn convert_errno(errno: i32) -> wasm32::__wasi_errno_t {
|
pub const __WASI_ENOLCK: __wasi_errno_t = 46;
|
||||||
#[allow(unreachable_patterns)]
|
pub const __WASI_ENOLINK: __wasi_errno_t = 47;
|
||||||
match errno {
|
pub const __WASI_ENOMEM: __wasi_errno_t = 48;
|
||||||
libc::E2BIG => wasm32::__WASI_E2BIG,
|
pub const __WASI_ENOMSG: __wasi_errno_t = 49;
|
||||||
libc::EACCES => wasm32::__WASI_EACCES,
|
pub const __WASI_ENOPROTOOPT: __wasi_errno_t = 50;
|
||||||
libc::EADDRINUSE => wasm32::__WASI_EADDRINUSE,
|
pub const __WASI_ENOSPC: __wasi_errno_t = 51;
|
||||||
libc::EADDRNOTAVAIL => wasm32::__WASI_EADDRNOTAVAIL,
|
pub const __WASI_ENOSYS: __wasi_errno_t = 52;
|
||||||
libc::EAFNOSUPPORT => wasm32::__WASI_EAFNOSUPPORT,
|
pub const __WASI_ENOTCONN: __wasi_errno_t = 53;
|
||||||
libc::EAGAIN | libc::EWOULDBLOCK => wasm32::__WASI_EAGAIN,
|
pub const __WASI_ENOTDIR: __wasi_errno_t = 54;
|
||||||
libc::EALREADY => wasm32::__WASI_EALREADY,
|
pub const __WASI_ENOTEMPTY: __wasi_errno_t = 55;
|
||||||
libc::EBADF => wasm32::__WASI_EBADF,
|
pub const __WASI_ENOTRECOVERABLE: __wasi_errno_t = 56;
|
||||||
libc::EBADMSG => wasm32::__WASI_EBADMSG,
|
pub const __WASI_ENOTSOCK: __wasi_errno_t = 57;
|
||||||
libc::EBUSY => wasm32::__WASI_EBUSY,
|
pub const __WASI_ENOTSUP: __wasi_errno_t = 58;
|
||||||
libc::ECANCELED => wasm32::__WASI_ECANCELED,
|
pub const __WASI_ENOTTY: __wasi_errno_t = 59;
|
||||||
libc::ECHILD => wasm32::__WASI_ECHILD,
|
pub const __WASI_ENXIO: __wasi_errno_t = 60;
|
||||||
libc::ECONNABORTED => wasm32::__WASI_ECONNABORTED,
|
pub const __WASI_EOVERFLOW: __wasi_errno_t = 61;
|
||||||
libc::ECONNREFUSED => wasm32::__WASI_ECONNREFUSED,
|
pub const __WASI_EOWNERDEAD: __wasi_errno_t = 62;
|
||||||
libc::ECONNRESET => wasm32::__WASI_ECONNRESET,
|
pub const __WASI_EPERM: __wasi_errno_t = 63;
|
||||||
libc::EDEADLK => wasm32::__WASI_EDEADLK,
|
pub const __WASI_EPIPE: __wasi_errno_t = 64;
|
||||||
libc::EDESTADDRREQ => wasm32::__WASI_EDESTADDRREQ,
|
pub const __WASI_EPROTO: __wasi_errno_t = 65;
|
||||||
libc::EDOM => wasm32::__WASI_EDOM,
|
pub const __WASI_EPROTONOSUPPORT: __wasi_errno_t = 66;
|
||||||
libc::EDQUOT => wasm32::__WASI_EDQUOT,
|
pub const __WASI_EPROTOTYPE: __wasi_errno_t = 67;
|
||||||
libc::EEXIST => wasm32::__WASI_EEXIST,
|
pub const __WASI_ERANGE: __wasi_errno_t = 68;
|
||||||
libc::EFAULT => wasm32::__WASI_EFAULT,
|
pub const __WASI_EROFS: __wasi_errno_t = 69;
|
||||||
libc::EFBIG => wasm32::__WASI_EFBIG,
|
pub const __WASI_ESPIPE: __wasi_errno_t = 70;
|
||||||
libc::EHOSTUNREACH => wasm32::__WASI_EHOSTUNREACH,
|
pub const __WASI_ESRCH: __wasi_errno_t = 71;
|
||||||
libc::EIDRM => wasm32::__WASI_EIDRM,
|
pub const __WASI_ESTALE: __wasi_errno_t = 72;
|
||||||
libc::EILSEQ => wasm32::__WASI_EILSEQ,
|
pub const __WASI_ETIMEDOUT: __wasi_errno_t = 73;
|
||||||
libc::EINPROGRESS => wasm32::__WASI_EINPROGRESS,
|
pub const __WASI_ETXTBSY: __wasi_errno_t = 74;
|
||||||
libc::EINTR => wasm32::__WASI_EINTR,
|
pub const __WASI_EXDEV: __wasi_errno_t = 75;
|
||||||
libc::EINVAL => wasm32::__WASI_EINVAL,
|
pub const __WASI_ENOTCAPABLE: __wasi_errno_t = 76;
|
||||||
libc::EIO => wasm32::__WASI_EIO,
|
|
||||||
libc::EISCONN => wasm32::__WASI_EISCONN,
|
|
||||||
libc::EISDIR => wasm32::__WASI_EISDIR,
|
|
||||||
libc::ELOOP => wasm32::__WASI_ELOOP,
|
|
||||||
libc::EMFILE => wasm32::__WASI_EMFILE,
|
|
||||||
libc::EMLINK => wasm32::__WASI_EMLINK,
|
|
||||||
libc::EMSGSIZE => wasm32::__WASI_EMSGSIZE,
|
|
||||||
libc::EMULTIHOP => wasm32::__WASI_EMULTIHOP,
|
|
||||||
libc::ENAMETOOLONG => wasm32::__WASI_ENAMETOOLONG,
|
|
||||||
libc::ENETDOWN => wasm32::__WASI_ENETDOWN,
|
|
||||||
libc::ENETRESET => wasm32::__WASI_ENETRESET,
|
|
||||||
libc::ENETUNREACH => wasm32::__WASI_ENETUNREACH,
|
|
||||||
libc::ENFILE => wasm32::__WASI_ENFILE,
|
|
||||||
libc::ENOBUFS => wasm32::__WASI_ENOBUFS,
|
|
||||||
libc::ENODEV => wasm32::__WASI_ENODEV,
|
|
||||||
libc::ENOENT => wasm32::__WASI_ENOENT,
|
|
||||||
libc::ENOEXEC => wasm32::__WASI_ENOEXEC,
|
|
||||||
libc::ENOLCK => wasm32::__WASI_ENOLCK,
|
|
||||||
libc::ENOLINK => wasm32::__WASI_ENOLINK,
|
|
||||||
libc::ENOMEM => wasm32::__WASI_ENOMEM,
|
|
||||||
libc::ENOMSG => wasm32::__WASI_ENOMSG,
|
|
||||||
libc::ENOPROTOOPT => wasm32::__WASI_ENOPROTOOPT,
|
|
||||||
libc::ENOSPC => wasm32::__WASI_ENOSPC,
|
|
||||||
libc::ENOSYS => wasm32::__WASI_ENOSYS,
|
|
||||||
// TODO: verify if this is correct
|
|
||||||
#[cfg(target_os = "freebsd")]
|
|
||||||
libc::ENOTCAPABLE => wasm32::__WASI_ENOTCAPABLE,
|
|
||||||
libc::ENOTCONN => wasm32::__WASI_ENOTCONN,
|
|
||||||
libc::ENOTDIR => wasm32::__WASI_ENOTDIR,
|
|
||||||
libc::ENOTEMPTY => wasm32::__WASI_ENOTEMPTY,
|
|
||||||
libc::ENOTRECOVERABLE => wasm32::__WASI_ENOTRECOVERABLE,
|
|
||||||
libc::ENOTSOCK => wasm32::__WASI_ENOTSOCK,
|
|
||||||
libc::ENOTSUP | libc::EOPNOTSUPP => wasm32::__WASI_ENOTSUP,
|
|
||||||
libc::ENOTTY => wasm32::__WASI_ENOTTY,
|
|
||||||
libc::ENXIO => wasm32::__WASI_ENXIO,
|
|
||||||
libc::EOVERFLOW => wasm32::__WASI_EOVERFLOW,
|
|
||||||
libc::EOWNERDEAD => wasm32::__WASI_EOWNERDEAD,
|
|
||||||
libc::EPERM => wasm32::__WASI_EPERM,
|
|
||||||
libc::EPIPE => wasm32::__WASI_EPIPE,
|
|
||||||
libc::EPROTO => wasm32::__WASI_EPROTO,
|
|
||||||
libc::EPROTONOSUPPORT => wasm32::__WASI_EPROTONOSUPPORT,
|
|
||||||
libc::EPROTOTYPE => wasm32::__WASI_EPROTOTYPE,
|
|
||||||
libc::ERANGE => wasm32::__WASI_ERANGE,
|
|
||||||
libc::EROFS => wasm32::__WASI_EROFS,
|
|
||||||
libc::ESPIPE => wasm32::__WASI_ESPIPE,
|
|
||||||
libc::ESRCH => wasm32::__WASI_ESRCH,
|
|
||||||
libc::ESTALE => wasm32::__WASI_ESTALE,
|
|
||||||
libc::ETIMEDOUT => wasm32::__WASI_ETIMEDOUT,
|
|
||||||
libc::ETXTBSY => wasm32::__WASI_ETXTBSY,
|
|
||||||
libc::EXDEV => wasm32::__WASI_EXDEV,
|
|
||||||
_ => wasm32::__WASI_ENOSYS,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,16 +1,103 @@
|
|||||||
use super::host;
|
use super::host;
|
||||||
use super::wasm32;
|
use super::wasm32;
|
||||||
|
use errno::{errno, Errno};
|
||||||
|
|
||||||
|
/// Convert POSIX error code to host's WASI error code
|
||||||
|
fn convert_errno(error: Errno) -> host::__wasi_errno_t {
|
||||||
|
#[allow(unreachable_patterns)]
|
||||||
|
match error.into() {
|
||||||
|
libc::E2BIG => host::__WASI_E2BIG,
|
||||||
|
libc::EACCES => host::__WASI_EACCES,
|
||||||
|
libc::EADDRINUSE => host::__WASI_EADDRINUSE,
|
||||||
|
libc::EADDRNOTAVAIL => host::__WASI_EADDRNOTAVAIL,
|
||||||
|
libc::EAFNOSUPPORT => host::__WASI_EAFNOSUPPORT,
|
||||||
|
libc::EAGAIN | libc::EWOULDBLOCK => host::__WASI_EAGAIN,
|
||||||
|
libc::EALREADY => host::__WASI_EALREADY,
|
||||||
|
libc::EBADF => host::__WASI_EBADF,
|
||||||
|
libc::EBADMSG => host::__WASI_EBADMSG,
|
||||||
|
libc::EBUSY => host::__WASI_EBUSY,
|
||||||
|
libc::ECANCELED => host::__WASI_ECANCELED,
|
||||||
|
libc::ECHILD => host::__WASI_ECHILD,
|
||||||
|
libc::ECONNABORTED => host::__WASI_ECONNABORTED,
|
||||||
|
libc::ECONNREFUSED => host::__WASI_ECONNREFUSED,
|
||||||
|
libc::ECONNRESET => host::__WASI_ECONNRESET,
|
||||||
|
libc::EDEADLK => host::__WASI_EDEADLK,
|
||||||
|
libc::EDESTADDRREQ => host::__WASI_EDESTADDRREQ,
|
||||||
|
libc::EDOM => host::__WASI_EDOM,
|
||||||
|
libc::EDQUOT => host::__WASI_EDQUOT,
|
||||||
|
libc::EEXIST => host::__WASI_EEXIST,
|
||||||
|
libc::EFAULT => host::__WASI_EFAULT,
|
||||||
|
libc::EFBIG => host::__WASI_EFBIG,
|
||||||
|
libc::EHOSTUNREACH => host::__WASI_EHOSTUNREACH,
|
||||||
|
libc::EIDRM => host::__WASI_EIDRM,
|
||||||
|
libc::EILSEQ => host::__WASI_EILSEQ,
|
||||||
|
libc::EINPROGRESS => host::__WASI_EINPROGRESS,
|
||||||
|
libc::EINTR => host::__WASI_EINTR,
|
||||||
|
libc::EINVAL => host::__WASI_EINVAL,
|
||||||
|
libc::EIO => host::__WASI_EIO,
|
||||||
|
libc::EISCONN => host::__WASI_EISCONN,
|
||||||
|
libc::EISDIR => host::__WASI_EISDIR,
|
||||||
|
libc::ELOOP => host::__WASI_ELOOP,
|
||||||
|
libc::EMFILE => host::__WASI_EMFILE,
|
||||||
|
libc::EMLINK => host::__WASI_EMLINK,
|
||||||
|
libc::EMSGSIZE => host::__WASI_EMSGSIZE,
|
||||||
|
libc::EMULTIHOP => host::__WASI_EMULTIHOP,
|
||||||
|
libc::ENAMETOOLONG => host::__WASI_ENAMETOOLONG,
|
||||||
|
libc::ENETDOWN => host::__WASI_ENETDOWN,
|
||||||
|
libc::ENETRESET => host::__WASI_ENETRESET,
|
||||||
|
libc::ENETUNREACH => host::__WASI_ENETUNREACH,
|
||||||
|
libc::ENFILE => host::__WASI_ENFILE,
|
||||||
|
libc::ENOBUFS => host::__WASI_ENOBUFS,
|
||||||
|
libc::ENODEV => host::__WASI_ENODEV,
|
||||||
|
libc::ENOENT => host::__WASI_ENOENT,
|
||||||
|
libc::ENOEXEC => host::__WASI_ENOEXEC,
|
||||||
|
libc::ENOLCK => host::__WASI_ENOLCK,
|
||||||
|
libc::ENOLINK => host::__WASI_ENOLINK,
|
||||||
|
libc::ENOMEM => host::__WASI_ENOMEM,
|
||||||
|
libc::ENOMSG => host::__WASI_ENOMSG,
|
||||||
|
libc::ENOPROTOOPT => host::__WASI_ENOPROTOOPT,
|
||||||
|
libc::ENOSPC => host::__WASI_ENOSPC,
|
||||||
|
libc::ENOSYS => host::__WASI_ENOSYS,
|
||||||
|
// TODO: verify if this is correct
|
||||||
|
#[cfg(target_os = "freebsd")]
|
||||||
|
libc::ENOTCAPABLE => host::__WASI_ENOTCAPABLE,
|
||||||
|
libc::ENOTCONN => host::__WASI_ENOTCONN,
|
||||||
|
libc::ENOTDIR => host::__WASI_ENOTDIR,
|
||||||
|
libc::ENOTEMPTY => host::__WASI_ENOTEMPTY,
|
||||||
|
libc::ENOTRECOVERABLE => host::__WASI_ENOTRECOVERABLE,
|
||||||
|
libc::ENOTSOCK => host::__WASI_ENOTSOCK,
|
||||||
|
libc::ENOTSUP | libc::EOPNOTSUPP => host::__WASI_ENOTSUP,
|
||||||
|
libc::ENOTTY => host::__WASI_ENOTTY,
|
||||||
|
libc::ENXIO => host::__WASI_ENXIO,
|
||||||
|
libc::EOVERFLOW => host::__WASI_EOVERFLOW,
|
||||||
|
libc::EOWNERDEAD => host::__WASI_EOWNERDEAD,
|
||||||
|
libc::EPERM => host::__WASI_EPERM,
|
||||||
|
libc::EPIPE => host::__WASI_EPIPE,
|
||||||
|
libc::EPROTO => host::__WASI_EPROTO,
|
||||||
|
libc::EPROTONOSUPPORT => host::__WASI_EPROTONOSUPPORT,
|
||||||
|
libc::EPROTOTYPE => host::__WASI_EPROTOTYPE,
|
||||||
|
libc::ERANGE => host::__WASI_ERANGE,
|
||||||
|
libc::EROFS => host::__WASI_EROFS,
|
||||||
|
libc::ESPIPE => host::__WASI_ESPIPE,
|
||||||
|
libc::ESRCH => host::__WASI_ESRCH,
|
||||||
|
libc::ESTALE => host::__WASI_ESTALE,
|
||||||
|
libc::ETIMEDOUT => host::__WASI_ETIMEDOUT,
|
||||||
|
libc::ETXTBSY => host::__WASI_ETXTBSY,
|
||||||
|
libc::EXDEV => host::__WASI_EXDEV,
|
||||||
|
_ => host::__WASI_ENOSYS,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn wasmtime_ssp_proc_exit(rval: wasm32::__wasi_exitcode_t) {
|
pub fn wasmtime_ssp_proc_exit(rval: wasm32::__wasi_exitcode_t) {
|
||||||
::std::process::exit(rval as i32)
|
::std::process::exit(rval as i32)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn wasmtime_ssp_sched_yield() -> wasm32::__wasi_errno_t {
|
pub fn wasmtime_ssp_sched_yield() -> host::__wasi_errno_t {
|
||||||
unsafe {
|
unsafe {
|
||||||
if libc::sched_yield() < 0 {
|
if libc::sched_yield() < 0 {
|
||||||
return host::convert_errno(host::errno());
|
return convert_errno(errno());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wasm32::__WASI_ESUCCESS
|
host::__WASI_ESUCCESS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ extern crate wasmtime_jit;
|
|||||||
extern crate wasmtime_runtime;
|
extern crate wasmtime_runtime;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
extern crate errno;
|
||||||
|
|
||||||
mod host;
|
mod host;
|
||||||
mod host_impls;
|
mod host_impls;
|
||||||
|
|||||||
Reference in New Issue
Block a user