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:
34
crates/wasi-common/src/old/snapshot_0/sys/unix/mod.rs
Normal file
34
crates/wasi-common/src/old/snapshot_0/sys/unix/mod.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
pub(crate) mod fdentry_impl;
|
||||
pub(crate) mod host_impl;
|
||||
pub(crate) mod hostcalls_impl;
|
||||
|
||||
mod dir;
|
||||
mod filetime;
|
||||
|
||||
#[cfg(any(
|
||||
target_os = "macos",
|
||||
target_os = "netbsd",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "ios",
|
||||
target_os = "dragonfly"
|
||||
))]
|
||||
mod bsd;
|
||||
#[cfg(target_os = "linux")]
|
||||
mod linux;
|
||||
|
||||
use crate::old::snapshot_0::{Error, Result};
|
||||
use std::ffi::CString;
|
||||
use std::fs::{File, OpenOptions};
|
||||
|
||||
pub(crate) fn dev_null() -> Result<File> {
|
||||
OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.open("/dev/null")
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
pub(crate) fn str_to_cstring(s: &str) -> Result<CString> {
|
||||
CString::new(s.as_bytes()).map_err(|_| Error::EILSEQ)
|
||||
}
|
||||
Reference in New Issue
Block a user