This commit merges [CraneStation/wasi-common] repo as a subdir of this repo while preserving **all** of git history. There is an initiative to pull `wasi-common` into [CraneStation/wasmtime], and [CraneStation/wasmtime] becoming a monorepo. This came about for several reasons with a common theme of convenience, namely, having a monorepo: 1. cleans up the problem of dependencies (as we have seen first hand with dependabot enabled, it can cause some grief) 2. completely removes the problem of syncing the closely dependent repos (e.g., updating `wasi-common` with say a bugfix generally implies creating a "sync" commit for pulling in the changes into the "parent" repo, in this case, `wasmtime`) 3. mainly for the two reasons above, makes publishing to crates.io easier 4. hopefully streamlines the process of getting the community involved in contributing to `wasi-common` as now everything is one place [CraneStation/wasi-common]: https://github.com/CraneStation/wasi-common [CraneStation/wasmtime]: https://github.com/CraneStation/wasmtime
25 lines
740 B
Rust
25 lines
740 B
Rust
use crate::wasi;
|
|
use cfg_if::cfg_if;
|
|
|
|
cfg_if! {
|
|
if #[cfg(unix)] {
|
|
mod unix;
|
|
pub(crate) use self::unix::*;
|
|
pub use self::unix::preopen_dir;
|
|
|
|
pub(crate) fn errno_from_host(err: i32) -> wasi::__wasi_errno_t {
|
|
host_impl::errno_from_nix(nix::errno::from_i32(err)).as_wasi_errno()
|
|
}
|
|
} else if #[cfg(windows)] {
|
|
mod windows;
|
|
pub(crate) use self::windows::*;
|
|
pub use self::windows::preopen_dir;
|
|
|
|
pub(crate) fn errno_from_host(err: i32) -> wasi::__wasi_errno_t {
|
|
host_impl::errno_from_win(winx::winerror::WinError::from_u32(err as u32))
|
|
}
|
|
} else {
|
|
compile_error!("wasi-common doesn't compile for this platform yet");
|
|
}
|
|
}
|