mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-06 04:38:25 +00:00
Merge branch 'master' into dash-fixes-and-pthreads
This commit is contained in:
@@ -898,7 +898,7 @@ Special thanks to [@ethanfrey](https://github.com/ethanfrey), [@AdamSLevy](https
|
||||
- [#992](https://github.com/wasmerio/wasmer/pull/992) Updates WAPM version to 0.4.1, fix arguments issue introduced in #990
|
||||
- [#990](https://github.com/wasmerio/wasmer/pull/990) Default wasmer CLI to `run`. Wasmer will now attempt to parse unrecognized command line options as if they were applied to the run command: `wasmer mywasm.wasm --dir=.` now works!
|
||||
- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc.
|
||||
- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasi::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1
|
||||
- [#957](https://github.com/wasmerio/wasmer/pull/957) Change the meaning of `wasmer_wasix::is_wasi_module` to detect any type of WASI module, add support for new wasi snapshot_preview1
|
||||
- [#934](https://github.com/wasmerio/wasmer/pull/934) Simplify float expressions in the LLVM backend.
|
||||
|
||||
## 0.10.2 - 2019-11-18
|
||||
|
||||
130
Cargo.lock
generated
130
Cargo.lock
generated
@@ -4515,6 +4515,43 @@ version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "virtual-fs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"derivative",
|
||||
"filetime",
|
||||
"fs_extra",
|
||||
"getrandom",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"pin-project-lite",
|
||||
"pretty_assertions",
|
||||
"slab",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"typetag",
|
||||
"webc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "virtual-net"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"libc",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
version = "1.0.2"
|
||||
@@ -4944,6 +4981,7 @@ dependencies = [
|
||||
"paste",
|
||||
"thiserror",
|
||||
"typetag",
|
||||
"virtual-fs",
|
||||
"wasmer",
|
||||
"wasmer-compiler",
|
||||
"wasmer-compiler-cranelift",
|
||||
@@ -4953,8 +4991,7 @@ dependencies = [
|
||||
"wasmer-inline-c",
|
||||
"wasmer-middlewares",
|
||||
"wasmer-types",
|
||||
"wasmer-vfs",
|
||||
"wasmer-wasi",
|
||||
"wasmer-wasix",
|
||||
"webc",
|
||||
]
|
||||
|
||||
@@ -5039,6 +5076,8 @@ dependencies = [
|
||||
"tracing-subscriber 0.3.16",
|
||||
"unix_mode",
|
||||
"url",
|
||||
"virtual-fs",
|
||||
"virtual-net",
|
||||
"walkdir",
|
||||
"wasm-coredump-builder",
|
||||
"wasmer",
|
||||
@@ -5052,12 +5091,9 @@ dependencies = [
|
||||
"wasmer-registry",
|
||||
"wasmer-toml",
|
||||
"wasmer-types",
|
||||
"wasmer-vfs",
|
||||
"wasmer-vm",
|
||||
"wasmer-vnet",
|
||||
"wasmer-wasi",
|
||||
"wasmer-wasi-experimental-io-devices",
|
||||
"wasmer-wasi-local-networking",
|
||||
"wasmer-wasix",
|
||||
"wasmer-wasix-experimental-io-devices",
|
||||
"wasmer-wasm-interface",
|
||||
"wasmer-wast",
|
||||
"wasmparser 0.51.4",
|
||||
@@ -5305,7 +5341,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-sys-utils"
|
||||
version = "3.2.0-alpha.1"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"region",
|
||||
@@ -5314,7 +5350,7 @@ dependencies = [
|
||||
"wasmer",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
"wasmer-wasi",
|
||||
"wasmer-wasix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5350,31 +5386,6 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-vfs"
|
||||
version = "3.2.0-alpha.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"derivative",
|
||||
"filetime",
|
||||
"fs_extra",
|
||||
"getrandom",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"pin-project-lite",
|
||||
"pretty_assertions",
|
||||
"slab",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"typetag",
|
||||
"webc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-vm"
|
||||
version = "3.2.0-alpha.1"
|
||||
@@ -5401,18 +5412,8 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-vnet"
|
||||
version = "3.2.0-alpha.1"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-wasi"
|
||||
version = "3.2.0-alpha.1"
|
||||
name = "wasmer-wasix"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@@ -5451,6 +5452,8 @@ dependencies = [
|
||||
"tracing-wasm",
|
||||
"typetag",
|
||||
"urlencoding",
|
||||
"virtual-fs",
|
||||
"virtual-net",
|
||||
"wai-bindgen-wasmer",
|
||||
"waker-fn",
|
||||
"wasm-bindgen",
|
||||
@@ -5459,11 +5462,8 @@ dependencies = [
|
||||
"wasmer-compiler",
|
||||
"wasmer-emscripten",
|
||||
"wasmer-types",
|
||||
"wasmer-vfs",
|
||||
"wasmer-vm",
|
||||
"wasmer-vnet",
|
||||
"wasmer-wasi-local-networking",
|
||||
"wasmer-wasi-types",
|
||||
"wasmer-wasix-types",
|
||||
"wcgi",
|
||||
"wcgi-host",
|
||||
"webc",
|
||||
@@ -5472,8 +5472,8 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-wasi-experimental-io-devices"
|
||||
version = "3.2.0-alpha.1"
|
||||
name = "wasmer-wasix-experimental-io-devices"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"minifb",
|
||||
"nix 0.25.1",
|
||||
@@ -5481,25 +5481,13 @@ dependencies = [
|
||||
"serde",
|
||||
"tracing",
|
||||
"typetag",
|
||||
"wasmer-wasi",
|
||||
"wasmer-wasi-types",
|
||||
"wasmer-wasix",
|
||||
"wasmer-wasix-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-wasi-local-networking"
|
||||
version = "3.2.0-alpha.1"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"libc",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"wasmer-vnet",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-wasi-types"
|
||||
version = "3.2.0-alpha.1"
|
||||
name = "wasmer-wasix-types"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags",
|
||||
@@ -5540,9 +5528,9 @@ dependencies = [
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"virtual-fs",
|
||||
"wasmer",
|
||||
"wasmer-vfs",
|
||||
"wasmer-wasi",
|
||||
"wasmer-wasix",
|
||||
"wast 38.0.1",
|
||||
]
|
||||
|
||||
@@ -5574,7 +5562,7 @@ dependencies = [
|
||||
"wasmer-emscripten",
|
||||
"wasmer-middlewares",
|
||||
"wasmer-types",
|
||||
"wasmer-wasi",
|
||||
"wasmer-wasix",
|
||||
"wasmer-wast",
|
||||
]
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ wasmer-compiler-cranelift = { version = "=3.2.0-alpha.1", path = "lib/compiler-c
|
||||
wasmer-compiler-singlepass = { version = "=3.2.0-alpha.1", path = "lib/compiler-singlepass", optional = true }
|
||||
wasmer-compiler-llvm = { version = "=3.2.0-alpha.1", path = "lib/compiler-llvm", optional = true }
|
||||
wasmer-emscripten = { version = "=3.2.0-alpha.1", path = "lib/emscripten", optional = true }
|
||||
wasmer-wasi = { version = "=3.2.0-alpha.1", path = "lib/wasi", optional = true }
|
||||
wasmer-wasix = { version = "0.1.0", path = "lib/wasi", optional = true }
|
||||
wasmer-wast = { version = "=3.2.0-alpha.1", path = "tests/lib/wast", optional = true }
|
||||
wasi-test-generator = { version = "=3.2.0-alpha.1", path = "tests/wasi-wast", optional = true }
|
||||
wasmer-cache = { version = "=3.2.0-alpha.1", path = "lib/cache", optional = true }
|
||||
@@ -49,7 +49,6 @@ members = [
|
||||
"lib/wasi",
|
||||
"lib/wasi-types",
|
||||
"lib/wasi-experimental-io-devices",
|
||||
"lib/wasi-local-networking",
|
||||
"lib/wasix/wasix-http-client",
|
||||
"lib/wasm-interface",
|
||||
"lib/c-api/tests/wasmer-c-api-test-runner",
|
||||
@@ -106,7 +105,7 @@ engine = ["universal"]
|
||||
universal = []
|
||||
cache = ["wasmer-cache"]
|
||||
wast = ["wasmer-wast"]
|
||||
wasi = ["wasmer-wasi"]
|
||||
wasi = ["wasmer-wasix"]
|
||||
emscripten = ["wasmer-emscripten"]
|
||||
wat = ["wasmer/wat"]
|
||||
compiler = ["wasmer/compiler", "wasmer-compiler/translator"]
|
||||
|
||||
@@ -18,7 +18,7 @@ use std::io::Read;
|
||||
|
||||
use wasmer::{Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_wasi::{Pipe, WasiEnv};
|
||||
use wasmer_wasix::{Pipe, WasiEnv};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let wasm_path = concat!(
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
use wasmer::{Instance, Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_wasi::WasiEnv;
|
||||
use wasmer_wasix::WasiEnv;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let wasm_path = concat!(
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
use std::io::{Read, Write};
|
||||
use wasmer::{Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_wasi::{Pipe, WasiEnv};
|
||||
use wasmer_wasix::{Pipe, WasiEnv};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let wasm_path = concat!(
|
||||
|
||||
@@ -29,9 +29,9 @@ wasmer-compiler-llvm = { version = "=3.2.0-alpha.1", path = "../compiler-llvm",
|
||||
wasmer-emscripten = { version = "=3.2.0-alpha.1", path = "../emscripten", optional = true }
|
||||
wasmer-compiler = { version = "=3.2.0-alpha.1", path = "../compiler" }
|
||||
wasmer-middlewares = { version = "=3.2.0-alpha.1", path = "../middlewares", optional = true }
|
||||
wasmer-wasi = { version = "=3.2.0-alpha.1", path = "../wasi", features = ["host-fs", "host-vnet"], optional = true }
|
||||
wasmer-wasix = { version = "0.1.0", path = "../wasi", features = ["host-fs", "host-vnet"], optional = true }
|
||||
wasmer-types = { version = "=3.2.0-alpha.1", path = "../types" }
|
||||
wasmer-vfs = { version = "=3.2.0-alpha.1", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] }
|
||||
virtual-fs = { version = "0.1.0", path = "../vfs", optional = true, default-features = false, features = ["static-fs"] }
|
||||
webc = { version = "5.0.0-rc.5", optional = true }
|
||||
enumset = "1.0.2"
|
||||
cfg-if = "1.0"
|
||||
@@ -59,7 +59,7 @@ default = [
|
||||
"middlewares",
|
||||
]
|
||||
wat = ["wasmer-api/wat"]
|
||||
wasi = ["wasmer-wasi"]
|
||||
wasi = ["wasmer-wasix"]
|
||||
middlewares = [
|
||||
"compiler",
|
||||
"wasmer-middlewares",
|
||||
@@ -92,7 +92,7 @@ wasmer-artifact-load = ["wasmer-compiler/wasmer-artifact-load"]
|
||||
wasmer-artifact-create = ["wasmer-compiler/wasmer-artifact-create"]
|
||||
static-artifact-load = ["wasmer-compiler/static-artifact-load"]
|
||||
static-artifact-create = ["wasmer-compiler/static-artifact-create"]
|
||||
webc_runner = ["wasmer-wasi/webc_runner", "wasmer-vfs", "webc"]
|
||||
webc_runner = ["wasmer-wasix/webc_runner", "virtual-fs", "webc"]
|
||||
# Deprecated features.
|
||||
jit = ["compiler"]
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ use std::os::raw::c_char;
|
||||
use std::slice;
|
||||
#[cfg(feature = "webc_runner")]
|
||||
use wasmer_api::{AsStoreMut, Imports, Module};
|
||||
use wasmer_wasi::{
|
||||
default_fs_backing, get_wasi_version, wasmer_vfs::AsyncReadExt, Pipe, VirtualTaskManager,
|
||||
use wasmer_wasix::{
|
||||
default_fs_backing, get_wasi_version, virtual_fs::AsyncReadExt, Pipe, VirtualTaskManager,
|
||||
WasiEnv, WasiEnvBuilder, WasiFile, WasiFunctionEnv, WasiVersion,
|
||||
};
|
||||
|
||||
@@ -248,7 +248,7 @@ fn prepare_webc_env(
|
||||
len: usize,
|
||||
package_name: &str,
|
||||
) -> Option<(WasiFunctionEnv, Imports)> {
|
||||
use wasmer_vfs::static_fs::StaticFileSystem;
|
||||
use virtual_fs::static_fs::StaticFileSystem;
|
||||
use webc::v1::{FsEntryType, WebC};
|
||||
|
||||
let slice = unsafe { std::slice::from_raw_parts(bytes, len) };
|
||||
|
||||
@@ -32,16 +32,15 @@ wasmer-compiler-singlepass = { version = "=3.2.0-alpha.1", path = "../compiler-s
|
||||
wasmer-compiler-llvm = { version = "=3.2.0-alpha.1", path = "../compiler-llvm", optional = true }
|
||||
wasmer-emscripten = { version = "=3.2.0-alpha.1", path = "../emscripten", optional = true }
|
||||
wasmer-vm = { version = "=3.2.0-alpha.1", path = "../vm" }
|
||||
wasmer-wasi = { version = "=3.2.0-alpha.1", path = "../wasi", optional = true }
|
||||
wasmer-wasi-experimental-io-devices = { version = "=3.2.0-alpha.1", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] }
|
||||
wasmer-wasi-local-networking = { version = "=3.2.0-alpha.1", path = "../wasi-local-networking", optional = true }
|
||||
wasmer-wasix = { version = "0.1.0", path = "../wasi", optional = true }
|
||||
wasmer-wasix-experimental-io-devices = { version = "0.1.0", path = "../wasi-experimental-io-devices", optional = true, features = ["link_external_libs"] }
|
||||
wasmer-wast = { version = "=3.2.0-alpha.1", path = "../../tests/lib/wast", optional = true }
|
||||
wasmer-cache = { version = "=3.2.0-alpha.1", path = "../cache", optional = true }
|
||||
wasmer-types = { version = "=3.2.0-alpha.1", path = "../types", features = ["enable-serde"] }
|
||||
wasmer-registry = { version = "=4.0.0", path = "../registry" }
|
||||
wasmer-object = { version = "=3.2.0-alpha.1", path = "../object", optional = true }
|
||||
wasmer-vfs = { version = "=3.2.0-alpha.1", path = "../vfs", default-features = false, features = ["host-fs"] }
|
||||
wasmer-vnet = { version = "=3.2.0-alpha.1", path = "../vnet" }
|
||||
virtual-fs = { version = "0.1.0", path = "../vfs", default-features = false, features = ["host-fs"] }
|
||||
virtual-net = { version = "0.1.0", path = "../vnet" }
|
||||
wasmer-wasm-interface = { version = "3.2.0-alpha.1", path = "../wasm-interface" }
|
||||
wasmparser = "0.51.4"
|
||||
atty = "0.2"
|
||||
@@ -116,14 +115,23 @@ default = [
|
||||
cache = ["wasmer-cache"]
|
||||
cache-blake3-pure = ["wasmer-cache/blake3-pure"]
|
||||
wast = ["wasmer-wast"]
|
||||
wasi = ["wasmer-wasi", "wasmer-wasi-local-networking"]
|
||||
wasi = ["wasmer-wasix", "host-net"]
|
||||
host-net = [ "virtual-net/host-net" ]
|
||||
emscripten = ["wasmer-emscripten"]
|
||||
wat = ["wasmer/wat"]
|
||||
webc_runner = ["wasi", "wasmer-wasi/webc_runner", "wasmer-wasi/webc_runner_rt_wasi", "wasmer-wasi/webc_runner_rt_wcgi", "wasmer-wasi/webc_runner_rt_emscripten", "nuke-dir", "webc"]
|
||||
webc_runner = [
|
||||
"wasi",
|
||||
"wasmer-wasix/webc_runner",
|
||||
"wasmer-wasix/webc_runner_rt_wasi",
|
||||
"wasmer-wasix/webc_runner_rt_wcgi",
|
||||
"wasmer-wasix/webc_runner_rt_emscripten",
|
||||
"nuke-dir",
|
||||
"webc"
|
||||
]
|
||||
compiler = [
|
||||
"wasmer-compiler/translator",
|
||||
"wasmer-compiler/compiler",
|
||||
"wasmer-wasi/compiler"
|
||||
"wasmer-wasix/compiler"
|
||||
]
|
||||
wasmer-artifact-create = ["compiler",
|
||||
"wasmer/wasmer-artifact-load",
|
||||
@@ -149,7 +157,7 @@ static-artifact-load = ["compiler",
|
||||
]
|
||||
|
||||
experimental-io-devices = [
|
||||
"wasmer-wasi-experimental-io-devices",
|
||||
"wasmer-wasix-experimental-io-devices",
|
||||
"wasi"
|
||||
]
|
||||
singlepass = [
|
||||
@@ -164,8 +172,8 @@ llvm = [
|
||||
"wasmer-compiler-llvm",
|
||||
"compiler",
|
||||
]
|
||||
debug = ["tracing", "wasmer-wasi/logging"]
|
||||
disable-all-logging = ["wasmer-wasi/disable-all-logging", "log/release_max_level_off"]
|
||||
debug = ["tracing", "wasmer-wasix/logging"]
|
||||
disable-all-logging = ["wasmer-wasix/disable-all-logging", "log/release_max_level_off"]
|
||||
headless = []
|
||||
headless-minimal = ["headless", "disable-all-logging", "wasi"]
|
||||
tracing = [ "dep:tracing", "tracing-subscriber" ]
|
||||
@@ -175,7 +183,7 @@ enable-serde = [
|
||||
"wasmer/enable-serde",
|
||||
"wasmer-vm/enable-serde",
|
||||
"wasmer-compiler/enable-serde",
|
||||
"wasmer-wasi/enable-serde",
|
||||
"wasmer-wasix/enable-serde",
|
||||
]
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
|
||||
@@ -21,7 +21,7 @@ use wasmer::*;
|
||||
use wasmer_cache::{Cache, FileSystemCache, Hash};
|
||||
use wasmer_types::Type as ValueType;
|
||||
#[cfg(feature = "webc_runner")]
|
||||
use wasmer_wasi::runners::{Runner, WapmContainer};
|
||||
use wasmer_wasix::runners::{Runner, WapmContainer};
|
||||
|
||||
#[cfg(feature = "wasi")]
|
||||
mod wasi;
|
||||
@@ -288,7 +288,7 @@ impl RunWithPathBuf {
|
||||
#[cfg(feature = "wasi")]
|
||||
let ret = {
|
||||
use std::collections::BTreeSet;
|
||||
use wasmer_wasi::WasiVersion;
|
||||
use wasmer_wasix::WasiVersion;
|
||||
|
||||
let wasi_versions = Wasi::get_versions(&module);
|
||||
match wasi_versions {
|
||||
@@ -393,14 +393,14 @@ impl RunWithPathBuf {
|
||||
.with_context(|| format!("No metadata found for the command, \"{id}\""))?;
|
||||
|
||||
let (store, _compiler_type) = self.store.get_store()?;
|
||||
let mut runner = wasmer_wasi::runners::wasi::WasiRunner::new(store);
|
||||
let mut runner = wasmer_wasix::runners::wasi::WasiRunner::new(store);
|
||||
runner.set_args(args.to_vec());
|
||||
if runner.can_run_command(id, command).unwrap_or(false) {
|
||||
return runner.run_cmd(&container, id).context("WASI runner failed");
|
||||
}
|
||||
|
||||
let (store, _compiler_type) = self.store.get_store()?;
|
||||
let mut runner = wasmer_wasi::runners::emscripten::EmscriptenRunner::new(store);
|
||||
let mut runner = wasmer_wasix::runners::emscripten::EmscriptenRunner::new(store);
|
||||
runner.set_args(args.to_vec());
|
||||
if runner.can_run_command(id, command).unwrap_or(false) {
|
||||
return runner
|
||||
@@ -408,7 +408,7 @@ impl RunWithPathBuf {
|
||||
.context("Emscripten runner failed");
|
||||
}
|
||||
|
||||
let mut runner = wasmer_wasi::runners::wcgi::WcgiRunner::new(id);
|
||||
let mut runner = wasmer_wasix::runners::wcgi::WcgiRunner::new(id);
|
||||
let (store, _compiler_type) = self.store.get_store()?;
|
||||
runner
|
||||
.config()
|
||||
|
||||
@@ -4,13 +4,13 @@ use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::{collections::BTreeSet, path::Path};
|
||||
use virtual_fs::FileSystem;
|
||||
use virtual_fs::{DeviceFile, PassthruFileSystem, RootFileSystemBuilder};
|
||||
use wasmer::{AsStoreMut, Instance, Module, RuntimeError, Value};
|
||||
use wasmer_vfs::FileSystem;
|
||||
use wasmer_vfs::{DeviceFile, PassthruFileSystem, RootFileSystemBuilder};
|
||||
use wasmer_wasi::os::tty_sys::SysTyy;
|
||||
use wasmer_wasi::os::TtyBridge;
|
||||
use wasmer_wasi::types::__WASI_STDIN_FILENO;
|
||||
use wasmer_wasi::{
|
||||
use wasmer_wasix::os::tty_sys::SysTty;
|
||||
use wasmer_wasix::os::TtyBridge;
|
||||
use wasmer_wasix::types::__WASI_STDIN_FILENO;
|
||||
use wasmer_wasix::{
|
||||
default_fs_backing, get_wasi_versions, PluggableRuntimeImplementation, WasiEnv, WasiError,
|
||||
WasiFunctionEnv, WasiVersion,
|
||||
};
|
||||
@@ -132,15 +132,13 @@ impl Wasi {
|
||||
let mut rt = PluggableRuntimeImplementation::default();
|
||||
|
||||
if self.networking {
|
||||
rt.set_networking_implementation(
|
||||
wasmer_wasi_local_networking::LocalNetworking::default(),
|
||||
);
|
||||
rt.set_networking_implementation(virtual_net::host::LocalNetworking::default());
|
||||
} else {
|
||||
rt.set_networking_implementation(wasmer_vnet::UnsupportedVirtualNetworking::default());
|
||||
rt.set_networking_implementation(virtual_net::UnsupportedVirtualNetworking::default());
|
||||
}
|
||||
|
||||
if !self.no_tty {
|
||||
let tty = Arc::new(SysTyy::default());
|
||||
let tty = Arc::new(SysTty::default());
|
||||
tty.reset();
|
||||
rt.set_tty(tty)
|
||||
}
|
||||
@@ -156,7 +154,7 @@ impl Wasi {
|
||||
.include_webcs(self.include_webcs.clone())
|
||||
.map_commands(map_commands);
|
||||
|
||||
let mut builder = if wasmer_wasi::is_wasix_module(module) {
|
||||
let mut builder = if wasmer_wasix::is_wasix_module(module) {
|
||||
// If we preopen anything from the host then shallow copy it over
|
||||
let root_fs = RootFileSystemBuilder::new()
|
||||
.with_tty(Box::new(DeviceFile::new(__WASI_STDIN_FILENO)))
|
||||
@@ -187,7 +185,7 @@ impl Wasi {
|
||||
};
|
||||
|
||||
if self.http_client {
|
||||
let caps = wasmer_wasi::http::HttpClientCapabilityV1::new_allow_all();
|
||||
let caps = wasmer_wasix::http::HttpClientCapabilityV1::new_allow_all();
|
||||
builder.capabilities_mut().http_client = caps;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasmer-sys-utils"
|
||||
version = "3.2.0-alpha.1"
|
||||
version = "0.1.0"
|
||||
description = "Wasmer utilities for a sys environment."
|
||||
categories = ["wasm"]
|
||||
keywords = ["wasm", "webassembly"]
|
||||
@@ -19,7 +19,7 @@ region = { version = "3.0" }
|
||||
libc = { version = "^0.2", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
wasmer-wasi = { path = "../wasi", version = "=3.2.0-alpha.1" }
|
||||
wasmer-wasix = { path = "../wasi", version = "0.1.0" }
|
||||
wasmer = { path = "../api", version = "=3.2.0-alpha.1", default-features = false, features = ["sys", "compiler", "cranelift"] }
|
||||
tracing-subscriber = { version = "0.3.16", features = ["fmt"] }
|
||||
tracing = "0.1.37"
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
// use wasmer::{BaseTunables, Engine, Module, Store, Tunables};
|
||||
// use wasmer_vm::VMMemory;
|
||||
// use wasmer_wasi::{
|
||||
// bin_factory::spawn_exec_module, wasmer_vfs::host_fs::File, BusSpawnedProcessJoin,
|
||||
// use wasmer_wasix::{
|
||||
// bin_factory::spawn_exec_module, virtual_fs::host_fs::File, BusSpawnedProcessJoin,
|
||||
// PluggableRuntimeImplementation, WasiControlPlane, WasiEnv, WasiRuntime,
|
||||
// WasiState,
|
||||
// };
|
||||
@@ -101,9 +101,9 @@
|
||||
// // .clone();
|
||||
|
||||
// // Generate an `ImportObject`.
|
||||
// // let instance = wasmer_wasi::build_wasi_instance(&module, &mut wasi_env, &mut store).unwrap();
|
||||
// // let instance = wasmer_wasix::build_wasi_instance(&module, &mut wasi_env, &mut store).unwrap();
|
||||
|
||||
// let config = wasmer_wasi::wasmer_vbus::SpawnOptionsConfig {
|
||||
// let config = wasmer_wasix::wasmer_vbus::SpawnOptionsConfig {
|
||||
// reuse: false,
|
||||
// env: wasi_env.data(&store).clone(),
|
||||
// remote_instance: None,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasmer-vfs"
|
||||
version = "3.2.0-alpha.1"
|
||||
name = "virtual-fs"
|
||||
version = "0.1.0"
|
||||
description = "Wasmer Virtual FileSystem"
|
||||
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||
license = "MIT"
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::{
|
||||
/// might do something like this:
|
||||
///
|
||||
/// ```rust
|
||||
/// use wasmer_vfs::{
|
||||
/// use virtual_fs::{
|
||||
/// mem_fs::FileSystem as MemFS,
|
||||
/// host_fs::FileSystem as HostFS,
|
||||
/// OverlayFileSystem,
|
||||
|
||||
@@ -311,7 +311,7 @@ impl FileSystem for UnionFileSystem {
|
||||
Err(err) => {
|
||||
// This fixes a bug when attempting to create the directory /usr when it does not exist
|
||||
// on the x86 version of memfs
|
||||
// TODO: patch wasmer_vfs and remove
|
||||
// TODO: patch virtual-fs and remove
|
||||
if let FsError::NotAFile = &err {
|
||||
ret_error = FsError::EntryNotFound;
|
||||
} else {
|
||||
@@ -335,7 +335,7 @@ impl FileSystem for UnionFileSystem {
|
||||
Err(err) => {
|
||||
// This fixes a bug when attempting to create the directory /usr when it does not exist
|
||||
// on the x86 version of memfs
|
||||
// TODO: patch wasmer_vfs and remove
|
||||
// TODO: patch virtual-fs and remove
|
||||
if let FsError::NotAFile = &err {
|
||||
ret_error = FsError::EntryNotFound;
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasmer-vnet"
|
||||
version = "3.2.0-alpha.1"
|
||||
name = "virtual-net"
|
||||
version = "0.1.0"
|
||||
description = "Wasmer Virtual Networking"
|
||||
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||
license = "MIT"
|
||||
@@ -8,6 +8,11 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
thiserror = "1"
|
||||
bytes = "1"
|
||||
bytes = "1.1"
|
||||
async-trait = { version = "^0.1" }
|
||||
tracing = "0.1"
|
||||
tokio = { version = "1", features = [ "sync", "macros", "io-util", "signal" ], default_features = false, optional = true }
|
||||
libc = { version = "0.2.139", optional = true }
|
||||
|
||||
[features]
|
||||
host-net = [ "tokio", "libc" ]
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
#![allow(unused_variables)]
|
||||
#[allow(unused_imports)]
|
||||
use crate::{
|
||||
IpCidr, IpRoute, NetworkError, Result, SocketStatus, StreamSecurity, VirtualConnectedSocket,
|
||||
VirtualConnectionlessSocket, VirtualIcmpSocket, VirtualNetworking, VirtualRawSocket,
|
||||
VirtualSocket, VirtualTcpListener, VirtualTcpSocket, VirtualUdpSocket,
|
||||
};
|
||||
use std::future::Future;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
|
||||
@@ -10,12 +16,6 @@ use std::time::Duration;
|
||||
use tokio::sync::mpsc;
|
||||
#[allow(unused_imports, dead_code)]
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
#[allow(unused_imports)]
|
||||
use wasmer_vnet::{
|
||||
IpCidr, IpRoute, NetworkError, Result, SocketStatus, StreamSecurity, VirtualConnectedSocket,
|
||||
VirtualConnectionlessSocket, VirtualIcmpSocket, VirtualNetworking, VirtualRawSocket,
|
||||
VirtualSocket, VirtualTcpListener, VirtualTcpSocket, VirtualUdpSocket,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct LocalNetworking {
|
||||
@@ -529,3 +529,6 @@ pub enum NetworkError {
|
||||
#[error("unknown error found")]
|
||||
UnknownError,
|
||||
}
|
||||
|
||||
#[cfg(feature = "host-net")]
|
||||
pub mod host;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "wasmer-wasi-experimental-io-devices"
|
||||
version = "3.2.0-alpha.1"
|
||||
description = "An experimental non-standard WASI extension for graphics"
|
||||
name = "wasmer-wasix-experimental-io-devices"
|
||||
version = "0.1.0"
|
||||
description = "An experimental non-standard WASI/WASIX extension for graphics"
|
||||
categories = ["wasm"]
|
||||
keywords = ["wasm", "webassembly", "types"]
|
||||
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||
@@ -14,8 +14,8 @@ edition = "2018"
|
||||
maintenance = { status = "experimental" }
|
||||
|
||||
[dependencies]
|
||||
wasmer-wasi = { version = "=3.2.0-alpha.1", path = "../wasi", default-features=false }
|
||||
wasmer-wasi-types = { path = "../wasi-types", version = "=3.2.0-alpha.1" }
|
||||
wasmer-wasix = { version = "0.1.0", path = "../wasi", default-features=false }
|
||||
wasmer-wasix-types = { path = "../wasi-types", version = "0.1.0" }
|
||||
tracing = "0.1"
|
||||
minifb = { version = "0.24.0", optional = true }
|
||||
nix = "0.25.0"
|
||||
@@ -25,10 +25,10 @@ typetag = "0.1"
|
||||
|
||||
[features]
|
||||
default = [
|
||||
"wasmer-wasi/default"
|
||||
"wasmer-wasix/default"
|
||||
]
|
||||
enable-serde = [
|
||||
"wasmer-wasi/enable-serde"
|
||||
"wasmer-wasix/enable-serde"
|
||||
]
|
||||
# This feature exists, so that "cargo build --all" doesn't
|
||||
# accidentally link libxcbcommon and libwayland into the CLI
|
||||
|
||||
@@ -6,9 +6,9 @@ pub mod link_ext;
|
||||
pub use crate::link_ext::*;
|
||||
|
||||
#[cfg(not(feature = "link_external_libs"))]
|
||||
use wasmer_wasi::fs::WasiFs;
|
||||
use wasmer_wasix::fs::WasiFs;
|
||||
#[cfg(not(feature = "link_external_libs"))]
|
||||
use wasmer_wasi::fs::WasiInodes;
|
||||
use wasmer_wasix::fs::WasiInodes;
|
||||
|
||||
#[cfg(not(feature = "link_external_libs"))]
|
||||
pub fn initialize(_: &WasiInodes, _: &mut WasiFs) -> Result<(), String> {
|
||||
|
||||
@@ -5,9 +5,9 @@ use std::collections::{BTreeSet, VecDeque};
|
||||
use std::convert::TryInto;
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
use tracing::debug;
|
||||
use wasmer_wasi::types::{wasi::Filesize, *};
|
||||
use wasmer_wasi::{VirtualFile, WasiFsError, ALL_RIGHTS};
|
||||
use wasmer_wasi_types::wasi::Fdflags;
|
||||
use wasmer_wasix::types::{wasi::Filesize, *};
|
||||
use wasmer_wasix::{VirtualFile, WasiFsError, ALL_RIGHTS};
|
||||
use wasmer_wasix_types::wasi::Fdflags;
|
||||
|
||||
use minifb::{Key, KeyRepeat, MouseButton, Scale, Window, WindowOptions};
|
||||
|
||||
@@ -16,8 +16,8 @@ mod util;
|
||||
use util::*;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use wasmer_wasi::os::fs::fd::Fd;
|
||||
use wasmer_wasi::os::fs::{WasiFs, WasiInodes, VIRTUAL_ROOT_FD};
|
||||
use wasmer_wasix::os::fs::fd::Fd;
|
||||
use wasmer_wasix::os::fs::{WasiFs, WasiInodes, VIRTUAL_ROOT_FD};
|
||||
std::thread_local! {
|
||||
pub(crate) static FRAMEBUFFER_STATE: RefCell<FrameBufferState> =
|
||||
RefCell::new(FrameBufferState::new()
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
[package]
|
||||
name = "wasmer-wasi-local-networking"
|
||||
version = "3.2.0-alpha.1"
|
||||
description = "An WASIX extension for local networking"
|
||||
categories = ["wasm"]
|
||||
keywords = ["wasm", "webassembly", "types"]
|
||||
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||
repository = "https://github.com/wasmerio/wasmer"
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "experimental" }
|
||||
|
||||
[dependencies]
|
||||
wasmer-vnet = { version = "=3.2.0-alpha.1", path = "../vnet" }
|
||||
tracing = "0.1"
|
||||
bytes = "1.1"
|
||||
tokio = { version = "1", features = [ "sync", "macros", "io-util", "signal" ], default_features = false }
|
||||
async-trait = { version = "^0.1" }
|
||||
libc = "0.2.139"
|
||||
@@ -1 +0,0 @@
|
||||
This is experimental extension of WASIX for networking.
|
||||
@@ -1,9 +1,9 @@
|
||||
[package]
|
||||
name = "wasmer-wasi-types"
|
||||
version = "3.2.0-alpha.1"
|
||||
description = "WASI types for Wasmer WebAssembly runtime"
|
||||
name = "wasmer-wasix-types"
|
||||
version = "0.1.0"
|
||||
description = "WASI and WASIX types for Wasmer WebAssembly runtime"
|
||||
categories = ["wasm", "os"]
|
||||
keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"]
|
||||
keywords = ["wasm", "webassembly", "wasi", "wasix", "sandbox", "ABI"]
|
||||
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||
repository = "https://github.com/wasmerio/wasmer"
|
||||
license = "MIT"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
[package]
|
||||
name = "wasmer-wasi"
|
||||
version = "3.2.0-alpha.1"
|
||||
description = "WASI implementation library for Wasmer WebAssembly runtime"
|
||||
name = "wasmer-wasix"
|
||||
version = "0.1.0"
|
||||
description = "WASI and WASIX implementation library for Wasmer WebAssembly runtime"
|
||||
categories = ["wasm", "os"]
|
||||
keywords = ["wasm", "webassembly", "wasi", "sandbox", "ABI"]
|
||||
keywords = ["wasm", "webassembly", "wasi", "wasix", "sandbox", "ABI"]
|
||||
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||
repository = "https://github.com/wasmerio/wasmer"
|
||||
license = "MIT"
|
||||
@@ -15,13 +15,12 @@ cfg-if = "1.0"
|
||||
thiserror = "1"
|
||||
tracing = { version = "0.1" }
|
||||
getrandom = "0.2"
|
||||
wasmer-wasi-types = { path = "../wasi-types", version = "=3.2.0-alpha.1" }
|
||||
wasmer-wasix-types = { path = "../wasi-types", version = "0.1.0" }
|
||||
wasmer-types = { path = "../types", version = "=3.2.0-alpha.1", default-features = false }
|
||||
wasmer = { path = "../api", version = "=3.2.0-alpha.1", default-features = false, features = ["wat", "js-serializable-module","tracing"] }
|
||||
wasmer-vfs = { path = "../vfs", version = "=3.2.0-alpha.1", default-features = false, features = ["webc-fs"] }
|
||||
wasmer = { path = "../api", version = "=3.2.0-alpha.1", default-features = false, features = ["wat", "js-serializable-module"] }
|
||||
wasmer-vm = { path = "../vm", version = "=3.2.0-alpha.1", optional = true }
|
||||
wasmer-vnet = { path = "../vnet", version = "=3.2.0-alpha.1", default-features = false }
|
||||
wasmer-wasi-local-networking = { path = "../wasi-local-networking", version = "=3.2.0-alpha.1", default-features = false, optional = true }
|
||||
virtual-fs = { path = "../vfs", version = "0.1.0", default-features = false, features = ["webc-fs"] }
|
||||
virtual-net = { path = "../vnet", version = "0.1.0", default-features = false }
|
||||
wasmer-emscripten = { path = "../emscripten", version = "=3.2.0-alpha.1", optional = true }
|
||||
typetag = { version = "0.1", optional = true }
|
||||
serde = { version = "1.0", default-features = false, features = ["derive"] }
|
||||
@@ -100,21 +99,21 @@ webc_runner_rt_wasi = []
|
||||
webc_runner_rt_wcgi = ["hyper", "wcgi", "wcgi-host"]
|
||||
webc_runner_rt_emscripten = ["wasmer-emscripten"]
|
||||
|
||||
sys = ["wasmer/sys", "wasmer-wasi-types/sys", "webc/mmap", "wasmer-vm", "time"]
|
||||
sys = ["wasmer/sys", "wasmer-wasix-types/sys", "webc/mmap", "wasmer-vm", "time"]
|
||||
sys-default = ["wasmer/wat", "wasmer/compiler", "sys", "logging", "host-fs", "sys-poll", "sys-thread", "host-vnet", "host-threads", "host-reqwest" ]
|
||||
sys-poll = []
|
||||
sys-thread = ["tokio/rt", "tokio/time", "tokio/rt-multi-thread"]
|
||||
|
||||
compiler = [ "wasmer/compiler", "wasmer-compiler"]
|
||||
|
||||
js = ["wasmer/js", "wasmer-vfs/no-time", "getrandom/js", "chrono", "wasmer-wasi-types/js"]
|
||||
js = ["wasmer/js", "virtual-fs/no-time", "getrandom/js", "chrono", "wasmer-wasix-types/js"]
|
||||
js-default = ["js", "wasmer/js-default"]
|
||||
test-js = ["js", "wasmer/js-default", "wasmer/wat"]
|
||||
|
||||
host-vnet = [ "wasmer-wasi-local-networking" ]
|
||||
host-vnet = [ "virtual-net/host-net" ]
|
||||
host-threads = []
|
||||
host-reqwest = ["reqwest"]
|
||||
host-fs = ["wasmer-vfs/host-fs"]
|
||||
host-fs = ["virtual-fs/host-fs"]
|
||||
|
||||
logging = ["tracing/log"]
|
||||
disable-all-logging = [
|
||||
@@ -123,7 +122,7 @@ disable-all-logging = [
|
||||
]
|
||||
enable-serde = [
|
||||
"typetag",
|
||||
"wasmer-vfs/enable-serde",
|
||||
"wasmer-wasi-types/enable-serde",
|
||||
"virtual-fs/enable-serde",
|
||||
"wasmer-wasix-types/enable-serde",
|
||||
]
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ Hello, Some("Gordon")
|
||||
|
||||
```rust
|
||||
use wasmer::{Store, Module, Instance};
|
||||
use wasmer_wasi::WasiState;
|
||||
use wasmer_wasix::WasiState;
|
||||
|
||||
let mut store = Store::default();
|
||||
let module = Module::from_file(&store, "hello.wasm")?;
|
||||
|
||||
@@ -6,8 +6,8 @@ use std::{
|
||||
};
|
||||
|
||||
use derivative::*;
|
||||
use wasmer_vfs::{FileSystem, TmpFileSystem};
|
||||
use wasmer_wasi_types::wasi::Snapshot0Clockid;
|
||||
use virtual_fs::{FileSystem, TmpFileSystem};
|
||||
use wasmer_wasix_types::wasi::Snapshot0Clockid;
|
||||
|
||||
use super::hash_of_binary;
|
||||
use crate::syscalls::platform_clock_time_get;
|
||||
|
||||
@@ -9,7 +9,7 @@ use tracing::*;
|
||||
#[cfg(feature = "sys")]
|
||||
use wasmer::NativeEngineExt;
|
||||
use wasmer::{FunctionEnvMut, Instance, Memory, Module, Store};
|
||||
use wasmer_wasi_types::wasi::Errno;
|
||||
use wasmer_wasix_types::wasi::Errno;
|
||||
|
||||
use super::{BinFactory, BinaryPackage, ModuleCache};
|
||||
use crate::{
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{
|
||||
sync::{Arc, RwLock},
|
||||
};
|
||||
|
||||
use wasmer_vfs::{AsyncReadExt, FileSystem};
|
||||
use virtual_fs::{AsyncReadExt, FileSystem};
|
||||
|
||||
mod binary_package;
|
||||
mod exec;
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::{
|
||||
};
|
||||
|
||||
use wasmer::Module;
|
||||
use wasmer_wasi_types::wasi::Snapshot0Clockid;
|
||||
use wasmer_wasix_types::wasi::Snapshot0Clockid;
|
||||
|
||||
use super::BinaryPackage;
|
||||
use crate::{syscalls::platform_clock_time_get, WasiRuntime};
|
||||
|
||||
@@ -7,8 +7,8 @@ use std::{
|
||||
|
||||
#[cfg(feature = "enable-serde")]
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use wasmer_vfs::{Pipe, VirtualFile};
|
||||
use wasmer_wasi_types::wasi::{Fd as WasiFd, Fdflags, Filestat, Rights};
|
||||
use virtual_fs::{Pipe, VirtualFile};
|
||||
use wasmer_wasix_types::wasi::{Fd as WasiFd, Fdflags, Filestat, Rights};
|
||||
|
||||
use crate::net::socket::InodeSocket;
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@ use std::{
|
||||
};
|
||||
|
||||
use tokio::io::{AsyncRead, AsyncSeek, AsyncWrite};
|
||||
use wasmer_vfs::{FsError, VirtualFile};
|
||||
use wasmer_vnet::NetworkError;
|
||||
use wasmer_wasi_types::{
|
||||
use virtual_fs::{FsError, VirtualFile};
|
||||
use virtual_net::NetworkError;
|
||||
use wasmer_wasix_types::{
|
||||
types::Eventtype,
|
||||
wasi,
|
||||
wasi::{Errno, Event, EventFdReadwrite, EventUnion, Eventrwflags, Subscription},
|
||||
|
||||
@@ -18,8 +18,8 @@ use crate::state::{Stderr, Stdin, Stdout};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use tokio::io::AsyncWriteExt;
|
||||
use tracing::{debug, trace};
|
||||
use wasmer_vfs::{FileSystem, FsError, OpenOptions, VirtualFile};
|
||||
use wasmer_wasi_types::{
|
||||
use virtual_fs::{FileSystem, FsError, OpenOptions, VirtualFile};
|
||||
use wasmer_wasix_types::{
|
||||
types::{__WASI_STDERR_FILENO, __WASI_STDIN_FILENO, __WASI_STDOUT_FILENO},
|
||||
wasi::{
|
||||
Errno, Fd as WasiFd, Fdflags, Fdstat, Filesize, Filestat, Filetype, Preopentype, Prestat,
|
||||
@@ -264,48 +264,48 @@ impl Default for WasiInodes {
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum WasiFsRoot {
|
||||
Sandbox(Arc<wasmer_vfs::tmp_fs::TmpFileSystem>),
|
||||
Sandbox(Arc<virtual_fs::tmp_fs::TmpFileSystem>),
|
||||
Backing(Arc<Box<dyn FileSystem>>),
|
||||
}
|
||||
|
||||
impl FileSystem for WasiFsRoot {
|
||||
fn read_dir(&self, path: &Path) -> wasmer_vfs::Result<wasmer_vfs::ReadDir> {
|
||||
fn read_dir(&self, path: &Path) -> virtual_fs::Result<virtual_fs::ReadDir> {
|
||||
match self {
|
||||
WasiFsRoot::Sandbox(fs) => fs.read_dir(path),
|
||||
WasiFsRoot::Backing(fs) => fs.read_dir(path),
|
||||
}
|
||||
}
|
||||
fn create_dir(&self, path: &Path) -> wasmer_vfs::Result<()> {
|
||||
fn create_dir(&self, path: &Path) -> virtual_fs::Result<()> {
|
||||
match self {
|
||||
WasiFsRoot::Sandbox(fs) => fs.create_dir(path),
|
||||
WasiFsRoot::Backing(fs) => fs.create_dir(path),
|
||||
}
|
||||
}
|
||||
fn remove_dir(&self, path: &Path) -> wasmer_vfs::Result<()> {
|
||||
fn remove_dir(&self, path: &Path) -> virtual_fs::Result<()> {
|
||||
match self {
|
||||
WasiFsRoot::Sandbox(fs) => fs.remove_dir(path),
|
||||
WasiFsRoot::Backing(fs) => fs.remove_dir(path),
|
||||
}
|
||||
}
|
||||
fn rename(&self, from: &Path, to: &Path) -> wasmer_vfs::Result<()> {
|
||||
fn rename(&self, from: &Path, to: &Path) -> virtual_fs::Result<()> {
|
||||
match self {
|
||||
WasiFsRoot::Sandbox(fs) => fs.rename(from, to),
|
||||
WasiFsRoot::Backing(fs) => fs.rename(from, to),
|
||||
}
|
||||
}
|
||||
fn metadata(&self, path: &Path) -> wasmer_vfs::Result<wasmer_vfs::Metadata> {
|
||||
fn metadata(&self, path: &Path) -> virtual_fs::Result<virtual_fs::Metadata> {
|
||||
match self {
|
||||
WasiFsRoot::Sandbox(fs) => fs.metadata(path),
|
||||
WasiFsRoot::Backing(fs) => fs.metadata(path),
|
||||
}
|
||||
}
|
||||
fn symlink_metadata(&self, path: &Path) -> wasmer_vfs::Result<wasmer_vfs::Metadata> {
|
||||
fn symlink_metadata(&self, path: &Path) -> virtual_fs::Result<virtual_fs::Metadata> {
|
||||
match self {
|
||||
WasiFsRoot::Sandbox(fs) => fs.symlink_metadata(path),
|
||||
WasiFsRoot::Backing(fs) => fs.symlink_metadata(path),
|
||||
}
|
||||
}
|
||||
fn remove_file(&self, path: &Path) -> wasmer_vfs::Result<()> {
|
||||
fn remove_file(&self, path: &Path) -> virtual_fs::Result<()> {
|
||||
match self {
|
||||
WasiFsRoot::Sandbox(fs) => fs.remove_file(path),
|
||||
WasiFsRoot::Backing(fs) => fs.remove_file(path),
|
||||
@@ -1771,12 +1771,12 @@ impl std::fmt::Debug for WasiFs {
|
||||
}
|
||||
|
||||
/// Returns the default filesystem backing
|
||||
pub fn default_fs_backing() -> Box<dyn wasmer_vfs::FileSystem + Send + Sync> {
|
||||
pub fn default_fs_backing() -> Box<dyn virtual_fs::FileSystem + Send + Sync> {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "host-fs")] {
|
||||
Box::new(wasmer_vfs::host_fs::FileSystem::default())
|
||||
Box::new(virtual_fs::host_fs::FileSystem::default())
|
||||
} else if #[cfg(not(feature = "host-fs"))] {
|
||||
Box::new(wasmer_vfs::mem_fs::FileSystem::default())
|
||||
Box::new(virtual_fs::mem_fs::FileSystem::default())
|
||||
} else {
|
||||
Box::new(FallbackFileSystem::default())
|
||||
}
|
||||
@@ -1793,7 +1793,7 @@ impl FallbackFileSystem {
|
||||
}
|
||||
|
||||
impl FileSystem for FallbackFileSystem {
|
||||
fn read_dir(&self, _path: &Path) -> Result<wasmer_vfs::ReadDir, FsError> {
|
||||
fn read_dir(&self, _path: &Path) -> Result<virtual_fs::ReadDir, FsError> {
|
||||
Self::fail();
|
||||
}
|
||||
fn create_dir(&self, _path: &Path) -> Result<(), FsError> {
|
||||
@@ -1805,21 +1805,21 @@ impl FileSystem for FallbackFileSystem {
|
||||
fn rename(&self, _from: &Path, _to: &Path) -> Result<(), FsError> {
|
||||
Self::fail();
|
||||
}
|
||||
fn metadata(&self, _path: &Path) -> Result<wasmer_vfs::Metadata, FsError> {
|
||||
fn metadata(&self, _path: &Path) -> Result<virtual_fs::Metadata, FsError> {
|
||||
Self::fail();
|
||||
}
|
||||
fn symlink_metadata(&self, _path: &Path) -> Result<wasmer_vfs::Metadata, FsError> {
|
||||
fn symlink_metadata(&self, _path: &Path) -> Result<virtual_fs::Metadata, FsError> {
|
||||
Self::fail();
|
||||
}
|
||||
fn remove_file(&self, _path: &Path) -> Result<(), FsError> {
|
||||
Self::fail();
|
||||
}
|
||||
fn new_open_options(&self) -> wasmer_vfs::OpenOptions {
|
||||
fn new_open_options(&self) -> virtual_fs::OpenOptions {
|
||||
Self::fail();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn virtual_file_type_to_wasi_file_type(file_type: wasmer_vfs::FileType) -> Filetype {
|
||||
pub fn virtual_file_type_to_wasi_file_type(file_type: virtual_fs::FileType) -> Filetype {
|
||||
// TODO: handle other file types
|
||||
if file_type.is_dir() {
|
||||
Filetype::Directory
|
||||
|
||||
@@ -65,27 +65,27 @@ use thiserror::Error;
|
||||
use tracing::error;
|
||||
// re-exports needed for OS
|
||||
pub use wasmer;
|
||||
pub use wasmer_wasi_types;
|
||||
pub use wasmer_wasix_types;
|
||||
|
||||
use wasmer::{
|
||||
imports, namespace, AsStoreMut, Exports, FunctionEnv, Imports, Memory32, MemoryAccessError,
|
||||
MemorySize, RuntimeError,
|
||||
};
|
||||
|
||||
pub use wasmer_vfs;
|
||||
#[deprecated(since = "2.1.0", note = "Please use `wasmer_vfs::FsError`")]
|
||||
pub use wasmer_vfs::FsError as WasiFsError;
|
||||
#[deprecated(since = "2.1.0", note = "Please use `wasmer_vfs::VirtualFile`")]
|
||||
pub use wasmer_vfs::VirtualFile as WasiFile;
|
||||
pub use wasmer_vfs::{DuplexPipe, FsError, Pipe, VirtualFile, WasiBidirectionalSharedPipePair};
|
||||
pub use wasmer_vnet;
|
||||
pub use wasmer_vnet::{UnsupportedVirtualNetworking, VirtualNetworking};
|
||||
pub use virtual_fs;
|
||||
#[deprecated(since = "2.1.0", note = "Please use `virtual_fs::FsError`")]
|
||||
pub use virtual_fs::FsError as WasiFsError;
|
||||
#[deprecated(since = "2.1.0", note = "Please use `virtual_fs::VirtualFile`")]
|
||||
pub use virtual_fs::VirtualFile as WasiFile;
|
||||
pub use virtual_fs::{DuplexPipe, FsError, Pipe, VirtualFile, WasiBidirectionalSharedPipePair};
|
||||
pub use virtual_net;
|
||||
pub use virtual_net::{UnsupportedVirtualNetworking, VirtualNetworking};
|
||||
|
||||
#[cfg(feature = "host-vnet")]
|
||||
pub use wasmer_wasi_local_networking::{
|
||||
pub use virtual_net::host::{
|
||||
io_err_into_net_error, LocalNetworking, LocalTcpListener, LocalTcpStream, LocalUdpSocket,
|
||||
};
|
||||
use wasmer_wasi_types::wasi::{BusErrno, Errno, ExitCode};
|
||||
use wasmer_wasix_types::wasi::{BusErrno, Errno, ExitCode};
|
||||
|
||||
pub use crate::{
|
||||
fs::{default_fs_backing, Fd, WasiFs, WasiInodes, VIRTUAL_ROOT_FD},
|
||||
|
||||
@@ -4,10 +4,10 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use virtual_net::{IpCidr, IpRoute, NetworkError};
|
||||
use wasmer::{MemoryView, WasmPtr};
|
||||
use wasmer_types::MemorySize;
|
||||
use wasmer_vnet::{IpCidr, IpRoute, NetworkError};
|
||||
use wasmer_wasi_types::{
|
||||
use wasmer_wasix_types::{
|
||||
types::{
|
||||
OptionTag, OptionTimestamp, Route, __wasi_addr_ip4_t, __wasi_addr_ip6_t,
|
||||
__wasi_addr_port_t, __wasi_addr_port_u, __wasi_addr_t, __wasi_addr_u, __wasi_cidr_t,
|
||||
|
||||
@@ -10,12 +10,12 @@ use std::{
|
||||
|
||||
#[cfg(feature = "enable-serde")]
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use wasmer_types::MemorySize;
|
||||
use wasmer_vnet::{
|
||||
use virtual_net::{
|
||||
VirtualIcmpSocket, VirtualNetworking, VirtualRawSocket, VirtualTcpListener, VirtualTcpSocket,
|
||||
VirtualUdpSocket,
|
||||
};
|
||||
use wasmer_wasi_types::wasi::{
|
||||
use wasmer_types::MemorySize;
|
||||
use wasmer_wasix_types::wasi::{
|
||||
Addressfamily, Errno, Fdflags, Rights, SockProto, Sockoption, Socktype,
|
||||
};
|
||||
|
||||
@@ -1213,7 +1213,7 @@ impl InodeSocketProtected {
|
||||
pub fn poll_read_ready(
|
||||
&mut self,
|
||||
cx: &mut std::task::Context<'_>,
|
||||
) -> std::task::Poll<wasmer_vnet::Result<usize>> {
|
||||
) -> std::task::Poll<virtual_net::Result<usize>> {
|
||||
match &mut self.kind {
|
||||
InodeSocketKind::TcpListener { socket, .. } => socket.poll_accept_ready(cx),
|
||||
InodeSocketKind::TcpStream { socket, .. } => socket.poll_read_ready(cx),
|
||||
@@ -1221,7 +1221,7 @@ impl InodeSocketProtected {
|
||||
InodeSocketKind::Raw(socket) => socket.poll_read_ready(cx),
|
||||
InodeSocketKind::Icmp(socket) => socket.poll_read_ready(cx),
|
||||
InodeSocketKind::PreSocket { .. } => {
|
||||
std::task::Poll::Ready(Err(wasmer_vnet::NetworkError::IOError))
|
||||
std::task::Poll::Ready(Err(virtual_net::NetworkError::IOError))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1229,7 +1229,7 @@ impl InodeSocketProtected {
|
||||
pub fn poll_write_ready(
|
||||
&mut self,
|
||||
cx: &mut std::task::Context<'_>,
|
||||
) -> std::task::Poll<wasmer_vnet::Result<usize>> {
|
||||
) -> std::task::Poll<virtual_net::Result<usize>> {
|
||||
match &mut self.kind {
|
||||
InodeSocketKind::TcpListener { .. } => std::task::Poll::Pending,
|
||||
InodeSocketKind::TcpStream { socket, .. } => socket.poll_write_ready(cx),
|
||||
@@ -1237,7 +1237,7 @@ impl InodeSocketProtected {
|
||||
InodeSocketKind::Raw(socket) => socket.poll_write_ready(cx),
|
||||
InodeSocketKind::Icmp(socket) => socket.poll_write_ready(cx),
|
||||
InodeSocketKind::PreSocket { .. } => {
|
||||
std::task::Poll::Ready(Err(wasmer_vnet::NetworkError::IOError))
|
||||
std::task::Poll::Ready(Err(virtual_net::NetworkError::IOError))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
VirtualBusError,
|
||||
};
|
||||
use wasmer::{FunctionEnvMut, Store};
|
||||
use wasmer_wasi_types::wasi::Errno;
|
||||
use wasmer_wasix_types::wasi::Errno;
|
||||
|
||||
use crate::{
|
||||
bin_factory::{spawn_exec, BinaryPackage, ModuleCache},
|
||||
|
||||
@@ -3,7 +3,7 @@ pub mod builtins;
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use wasmer::{FunctionEnvMut, Store};
|
||||
use wasmer_wasi_types::wasi::Errno;
|
||||
use wasmer_wasix_types::wasi::Errno;
|
||||
|
||||
use crate::{
|
||||
bin_factory::ModuleCache, syscalls::stderr_write, VirtualBusError, WasiEnv, WasiRuntime,
|
||||
|
||||
@@ -16,13 +16,13 @@ use linked_hash_set::LinkedHashSet;
|
||||
use tokio::sync::{mpsc, RwLock};
|
||||
#[allow(unused_imports, dead_code)]
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
#[cfg(feature = "sys")]
|
||||
use wasmer::Engine;
|
||||
use wasmer_vfs::{
|
||||
use virtual_fs::{
|
||||
ArcBoxFile, ArcFile, AsyncWriteExt, CombineFile, DeviceFile, DuplexPipe, FileSystem, Pipe,
|
||||
PipeRx, PipeTx, RootFileSystemBuilder, VirtualFile,
|
||||
};
|
||||
use wasmer_wasi_types::{types::__WASI_STDIN_FILENO, wasi::BusErrno};
|
||||
#[cfg(feature = "sys")]
|
||||
use wasmer::Engine;
|
||||
use wasmer_wasix_types::{types::__WASI_STDIN_FILENO, wasi::BusErrno};
|
||||
|
||||
use super::{cconst::ConsoleConst, common::*, task::TaskJoinHandle};
|
||||
use crate::{
|
||||
@@ -209,7 +209,7 @@ impl Console {
|
||||
} else {
|
||||
let mut stderr = self.stderr.clone();
|
||||
tasks.block_on(async {
|
||||
wasmer_vfs::AsyncWriteExt::write_all(
|
||||
virtual_fs::AsyncWriteExt::write_all(
|
||||
&mut stderr,
|
||||
format!("package not found [{}]\r\n", webc).as_bytes(),
|
||||
)
|
||||
@@ -229,7 +229,7 @@ impl Console {
|
||||
if let Err(err) = env.uses(self.uses.clone()) {
|
||||
let mut stderr = self.stderr.clone();
|
||||
tasks.block_on(async {
|
||||
wasmer_vfs::AsyncWriteExt::write_all(
|
||||
virtual_fs::AsyncWriteExt::write_all(
|
||||
&mut stderr,
|
||||
format!("{}\r\n", err).as_bytes(),
|
||||
)
|
||||
@@ -268,7 +268,7 @@ impl Console {
|
||||
data.insert_str(0, ConsoleConst::TERM_NO_WRAPAROUND);
|
||||
|
||||
let mut stderr = self.stderr.clone();
|
||||
wasmer_vfs::AsyncWriteExt::write_all(&mut stderr, data.as_str().as_bytes())
|
||||
virtual_fs::AsyncWriteExt::write_all(&mut stderr, data.as_str().as_bytes())
|
||||
.await
|
||||
.ok();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use std::{
|
||||
|
||||
use crate::WasiRuntimeError;
|
||||
use tracing::trace;
|
||||
use wasmer_wasi_types::{
|
||||
use wasmer_wasix_types::{
|
||||
types::Signal,
|
||||
wasi::{Errno, ExitCode, Snapshot0Clockid, TlKey, TlUser, TlVal},
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use wasmer_wasi_types::types::Signal;
|
||||
use wasmer_wasix_types::types::Signal;
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
#[error("Signal could not be delivered")]
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
use wasmer_wasi_types::wasi::{Errno, ExitCode};
|
||||
use wasmer_wasix_types::wasi::{Errno, ExitCode};
|
||||
|
||||
use crate::WasiRuntimeError;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::{
|
||||
};
|
||||
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use wasmer_wasi_types::{
|
||||
use wasmer_wasix_types::{
|
||||
types::Signal,
|
||||
wasi::{Errno, ExitCode},
|
||||
};
|
||||
|
||||
@@ -5,8 +5,8 @@ use std::{
|
||||
|
||||
use derivative::*;
|
||||
use futures::future::BoxFuture;
|
||||
use wasmer_vfs::{AsyncWriteExt, NullFile, VirtualFile};
|
||||
use wasmer_wasi_types::wasi::{Signal, Snapshot0Clockid};
|
||||
use virtual_fs::{AsyncWriteExt, NullFile, VirtualFile};
|
||||
use wasmer_wasix_types::wasi::{Signal, Snapshot0Clockid};
|
||||
|
||||
use crate::syscalls::platform_clock_time_get;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ use crate::WasiTtyState;
|
||||
|
||||
/// [`TtyBridge`] implementation for Unix systems.
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct SysTyy;
|
||||
pub struct SysTty;
|
||||
|
||||
impl TtyBridge for SysTyy {
|
||||
impl TtyBridge for SysTty {
|
||||
fn reset(&self) {
|
||||
sys::reset().ok();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
|
||||
use bytes::Bytes;
|
||||
use wasmer_vfs::{webc_fs::WebcFileSystem, FileSystem};
|
||||
use virtual_fs::{webc_fs::WebcFileSystem, FileSystem};
|
||||
use webc::{
|
||||
metadata::Manifest,
|
||||
v1::{ParseOptions, WebC, WebCMmap, WebCOwned},
|
||||
|
||||
@@ -15,8 +15,8 @@ use tokio::{
|
||||
io::{AsyncBufReadExt, AsyncRead, AsyncWrite, AsyncWriteExt},
|
||||
runtime::Handle,
|
||||
};
|
||||
use virtual_fs::{FileSystem, PassthruFileSystem, RootFileSystemBuilder, TmpFileSystem};
|
||||
use wasmer::Module;
|
||||
use wasmer_vfs::{FileSystem, PassthruFileSystem, RootFileSystemBuilder, TmpFileSystem};
|
||||
use wcgi_host::CgiDialect;
|
||||
|
||||
use crate::{
|
||||
|
||||
@@ -2,8 +2,8 @@ use std::{collections::HashMap, convert::Infallible, net::SocketAddr, path::Path
|
||||
|
||||
use anyhow::{Context, Error};
|
||||
use futures::future::AbortHandle;
|
||||
use virtual_fs::FileSystem;
|
||||
use wasmer::{Engine, Module, Store};
|
||||
use wasmer_vfs::FileSystem;
|
||||
use wcgi_host::CgiDialect;
|
||||
use webc::metadata::{
|
||||
annotations::{Wasi, Wcgi},
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
pub mod task_manager;
|
||||
|
||||
use crate::{http::DynHttpClient, os::TtyBridge, WasiTtyState};
|
||||
|
||||
pub use self::task_manager::{SpawnType, SpawnedMemory, VirtualTaskManager};
|
||||
|
||||
use crate::{http::DynHttpClient, os::TtyBridge, WasiTtyState};
|
||||
use derivative::Derivative;
|
||||
use std::{
|
||||
fmt,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
use wasmer_vnet::{DynVirtualNetworking, VirtualNetworking};
|
||||
|
||||
use derivative::Derivative;
|
||||
use virtual_net::{DynVirtualNetworking, VirtualNetworking};
|
||||
|
||||
#[cfg(feature = "sys")]
|
||||
pub type ArcTunables = std::sync::Arc<dyn wasmer::Tunables + Send + Sync>;
|
||||
@@ -116,9 +118,9 @@ impl PluggableRuntimeImplementation {
|
||||
// TODO: the cfg flags below should instead be handled by separate implementations.
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "host-vnet")] {
|
||||
let networking = Arc::new(wasmer_wasi_local_networking::LocalNetworking::default());
|
||||
let networking = Arc::new(virtual_net::host::LocalNetworking::default());
|
||||
} else {
|
||||
let networking = Arc::new(wasmer_vnet::UnsupportedVirtualNetworking::default());
|
||||
let networking = Arc::new(virtual_net::UnsupportedVirtualNetworking::default());
|
||||
}
|
||||
}
|
||||
cfg_if::cfg_if! {
|
||||
|
||||
@@ -8,9 +8,9 @@ use std::{
|
||||
|
||||
use rand::Rng;
|
||||
use thiserror::Error;
|
||||
use virtual_fs::{ArcFile, FsError, TmpFileSystem, VirtualFile};
|
||||
use wasmer::{AsStoreMut, Instance, Module};
|
||||
use wasmer_vfs::{ArcFile, FsError, TmpFileSystem, VirtualFile};
|
||||
use wasmer_wasi_types::wasi::Errno;
|
||||
use wasmer_wasix_types::wasi::Errno;
|
||||
|
||||
use crate::{
|
||||
bin_factory::{BinFactory, ModuleCache},
|
||||
@@ -29,7 +29,7 @@ use super::env::WasiEnvInit;
|
||||
///
|
||||
/// Usage:
|
||||
/// ```no_run
|
||||
/// # use wasmer_wasi::{WasiEnv, WasiStateCreationError};
|
||||
/// # use wasmer_wasix::{WasiEnv, WasiStateCreationError};
|
||||
/// # fn main() -> Result<(), WasiStateCreationError> {
|
||||
/// let mut state_builder = WasiEnv::builder("wasi-prog-name");
|
||||
/// state_builder
|
||||
@@ -368,7 +368,7 @@ impl WasiEnvBuilder {
|
||||
/// Usage:
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use wasmer_wasi::{WasiEnv, WasiStateCreationError};
|
||||
/// # use wasmer_wasix::{WasiEnv, WasiStateCreationError};
|
||||
/// # fn main() -> Result<(), WasiStateCreationError> {
|
||||
/// WasiEnv::builder("program_name")
|
||||
/// .preopen_build(|p| p.directory("src").read(true).write(true).create(true))?
|
||||
@@ -390,7 +390,7 @@ impl WasiEnvBuilder {
|
||||
/// Usage:
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use wasmer_wasi::{WasiEnv, WasiStateCreationError};
|
||||
/// # use wasmer_wasix::{WasiEnv, WasiStateCreationError};
|
||||
/// # fn main() -> Result<(), WasiStateCreationError> {
|
||||
/// WasiEnv::builder("program_name")
|
||||
/// .preopen_build(|p| p.directory("src").read(true).write(true).create(true))?
|
||||
@@ -508,19 +508,19 @@ impl WasiEnvBuilder {
|
||||
|
||||
/// Sets the FileSystem to be used with this WASI instance.
|
||||
///
|
||||
/// This is usually used in case a custom `wasmer_vfs::FileSystem` is needed.
|
||||
pub fn fs(mut self, fs: Box<dyn wasmer_vfs::FileSystem + Send + Sync>) -> Self {
|
||||
/// This is usually used in case a custom `virtual_fs::FileSystem` is needed.
|
||||
pub fn fs(mut self, fs: Box<dyn virtual_fs::FileSystem + Send + Sync>) -> Self {
|
||||
self.set_fs(fs);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_fs(&mut self, fs: Box<dyn wasmer_vfs::FileSystem + Send + Sync>) {
|
||||
pub fn set_fs(&mut self, fs: Box<dyn virtual_fs::FileSystem + Send + Sync>) {
|
||||
self.fs = Some(WasiFsRoot::Backing(Arc::new(fs)));
|
||||
}
|
||||
|
||||
/// Sets a new sandbox FileSystem to be used with this WASI instance.
|
||||
///
|
||||
/// This is usually used in case a custom `wasmer_vfs::FileSystem` is needed.
|
||||
/// This is usually used in case a custom `virtual_fs::FileSystem` is needed.
|
||||
pub fn sandbox_fs(mut self, fs: TmpFileSystem) -> Self {
|
||||
self.fs = Some(WasiFsRoot::Sandbox(Arc::new(fs)));
|
||||
self
|
||||
|
||||
@@ -3,15 +3,15 @@ use std::{collections::HashMap, ops::Deref, path::PathBuf, sync::Arc, time::Dura
|
||||
use derivative::Derivative;
|
||||
use rand::Rng;
|
||||
use tracing::{trace, warn};
|
||||
use virtual_fs::{FsError, VirtualFile};
|
||||
use virtual_net::DynVirtualNetworking;
|
||||
#[cfg(feature = "sys")]
|
||||
use wasmer::NativeEngineExt;
|
||||
use wasmer::{
|
||||
AsStoreMut, AsStoreRef, FunctionEnvMut, Global, Instance, Memory, MemoryView, Module,
|
||||
TypedFunction,
|
||||
};
|
||||
use wasmer_vfs::{FsError, VirtualFile};
|
||||
use wasmer_vnet::DynVirtualNetworking;
|
||||
use wasmer_wasi_types::{
|
||||
use wasmer_wasix_types::{
|
||||
types::Signal,
|
||||
wasi::{Errno, ExitCode, Snapshot0Clockid},
|
||||
};
|
||||
@@ -771,7 +771,7 @@ impl WasiEnv {
|
||||
use std::{borrow::Cow, collections::VecDeque};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use wasmer_vfs::FileSystem;
|
||||
use virtual_fs::FileSystem;
|
||||
|
||||
let mut already: HashMap<String, Cow<'static, str>> = HashMap::new();
|
||||
|
||||
@@ -864,7 +864,7 @@ impl WasiEnv {
|
||||
use std::path::Path;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use wasmer_vfs::FileSystem;
|
||||
use virtual_fs::FileSystem;
|
||||
|
||||
#[cfg(feature = "sys")]
|
||||
for (command, target) in map_commands.iter() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use tracing::trace;
|
||||
use wasmer::{AsStoreMut, AsStoreRef, ExportError, FunctionEnv, Imports, Instance, Memory, Module};
|
||||
use wasmer_wasi_types::wasi::ExitCode;
|
||||
use wasmer_wasix_types::wasi::ExitCode;
|
||||
|
||||
use crate::{
|
||||
state::WasiInstanceHandles,
|
||||
|
||||
@@ -32,9 +32,9 @@ use std::{
|
||||
use derivative::Derivative;
|
||||
#[cfg(feature = "enable-serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use virtual_fs::{FileOpener, FileSystem, FsError, OpenOptions, VirtualFile};
|
||||
use wasmer::Store;
|
||||
use wasmer_vfs::{FileOpener, FileSystem, FsError, OpenOptions, VirtualFile};
|
||||
use wasmer_wasi_types::wasi::{Errno, Fd as WasiFd, Rights, Snapshot0Clockid};
|
||||
use wasmer_wasix_types::wasi::{Errno, Fd as WasiFd, Rights, Snapshot0Clockid};
|
||||
|
||||
pub use self::{
|
||||
builder::*,
|
||||
@@ -61,8 +61,8 @@ impl FileOpener for WasiStateOpener {
|
||||
fn open(
|
||||
&self,
|
||||
path: &Path,
|
||||
conf: &wasmer_vfs::OpenOptionsConfig,
|
||||
) -> wasmer_vfs::Result<Box<dyn VirtualFile + Send + Sync + 'static>> {
|
||||
conf: &virtual_fs::OpenOptionsConfig,
|
||||
) -> virtual_fs::Result<Box<dyn VirtualFile + Send + Sync + 'static>> {
|
||||
let mut new_options = self.root_fs.new_open_options();
|
||||
new_options.options(conf.clone());
|
||||
new_options.open(path)
|
||||
@@ -180,7 +180,7 @@ impl WasiState {
|
||||
pub(crate) fn fs_read_dir<P: AsRef<Path>>(
|
||||
&self,
|
||||
path: P,
|
||||
) -> Result<wasmer_vfs::ReadDir, Errno> {
|
||||
) -> Result<virtual_fs::ReadDir, Errno> {
|
||||
self.fs
|
||||
.root_fs
|
||||
.read_dir(path.as_ref())
|
||||
|
||||
@@ -5,15 +5,15 @@ use cfg_if::cfg_if;
|
||||
#[cfg(feature = "enable-serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use wasmer_wasi_types::wasi::{BusErrno, Rights};
|
||||
use wasmer_wasix_types::wasi::{BusErrno, Rights};
|
||||
|
||||
use crate::VirtualBusError;
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "host-fs")] {
|
||||
pub use wasmer_vfs::host_fs::{Stderr, Stdin, Stdout};
|
||||
pub use virtual_fs::host_fs::{Stderr, Stdin, Stdout};
|
||||
} else {
|
||||
pub use wasmer_vfs::mem_fs::{Stderr, Stdin, Stdout};
|
||||
pub use virtual_fs::mem_fs::{Stderr, Stdin, Stdout};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use tracing::{field, instrument, trace_span};
|
||||
use wasmer::{AsStoreMut, FunctionEnvMut, WasmPtr};
|
||||
use wasmer_wasi_types::wasi::{
|
||||
use wasmer_wasix_types::wasi::{
|
||||
Errno, Event, EventFdReadwrite, Eventrwflags, Eventtype, Fd, Filesize, Filestat, Filetype,
|
||||
Snapshot0Event, Snapshot0Filestat, Snapshot0Subscription, Snapshot0Whence, Subscription,
|
||||
Whence,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![allow(unused, clippy::too_many_arguments, clippy::cognitive_complexity)]
|
||||
|
||||
pub mod types {
|
||||
pub use wasmer_wasi_types::{types::*, wasi};
|
||||
pub use wasmer_wasix_types::{types::*, wasi};
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
@@ -63,16 +63,16 @@ pub use unix::*;
|
||||
#[cfg(any(target_family = "wasm"))]
|
||||
pub use wasm::*;
|
||||
|
||||
pub(crate) use virtual_fs::{
|
||||
AsyncSeekExt, AsyncWriteExt, DuplexPipe, FileSystem, FsError, VirtualFile,
|
||||
};
|
||||
pub(crate) use virtual_net::StreamSecurity;
|
||||
pub(crate) use wasmer::{
|
||||
AsStoreMut, AsStoreRef, Extern, Function, FunctionEnv, FunctionEnvMut, Global, Instance,
|
||||
Memory, Memory32, Memory64, MemoryAccessError, MemoryError, MemorySize, MemoryView, Module,
|
||||
OnCalledAction, Pages, RuntimeError, Store, TypedFunction, Value, WasmPtr, WasmSlice,
|
||||
};
|
||||
pub(crate) use wasmer_vfs::{
|
||||
AsyncSeekExt, AsyncWriteExt, DuplexPipe, FileSystem, FsError, VirtualFile,
|
||||
};
|
||||
pub(crate) use wasmer_vnet::StreamSecurity;
|
||||
pub(crate) use wasmer_wasi_types::{asyncify::__wasi_asyncify_t, wasi::EventUnion};
|
||||
pub(crate) use wasmer_wasix_types::{asyncify::__wasi_asyncify_t, wasi::EventUnion};
|
||||
#[cfg(any(target_os = "windows"))]
|
||||
pub use windows::*;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ use libc::{
|
||||
CLOCK_REALTIME, CLOCK_THREAD_CPUTIME_ID,
|
||||
};
|
||||
use wasmer::WasmRef;
|
||||
use wasmer_wasi_types::wasi::{Errno, Snapshot0Clockid, Timestamp};
|
||||
use wasmer_wasix_types::wasi::{Errno, Snapshot0Clockid, Timestamp};
|
||||
|
||||
use crate::syscalls::types::*;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::{collections::VecDeque, task::Waker};
|
||||
|
||||
use wasmer_vfs::{AsyncReadExt, ReadBuf};
|
||||
use virtual_fs::{AsyncReadExt, ReadBuf};
|
||||
|
||||
use super::*;
|
||||
use crate::{fs::NotificationInner, syscalls::*};
|
||||
@@ -280,7 +280,7 @@ fn fd_read_internal<M: MemorySize>(
|
||||
.map_err(mem_error_to_wasi)?;
|
||||
|
||||
total_read +=
|
||||
wasmer_vfs::AsyncReadExt::read(&mut pipe, buf.as_mut()).await?;
|
||||
virtual_fs::AsyncReadExt::read(&mut pipe, buf.as_mut()).await?;
|
||||
}
|
||||
Ok(total_read)
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ pub fn path_open<M: MemorySize>(
|
||||
(false, false, false)
|
||||
};
|
||||
|
||||
wasmer_vfs::OpenOptionsConfig {
|
||||
virtual_fs::OpenOptionsConfig {
|
||||
read: fs_rights_base.contains(Rights::FD_READ),
|
||||
write: write_permission,
|
||||
create_new: create_permission && o_flags.contains(Oflags::EXCL),
|
||||
@@ -118,7 +118,7 @@ pub fn path_open<M: MemorySize>(
|
||||
truncate: truncate_permission,
|
||||
}
|
||||
}
|
||||
Err(_) => wasmer_vfs::OpenOptionsConfig {
|
||||
Err(_) => virtual_fs::OpenOptionsConfig {
|
||||
append: fs_flags.contains(Fdflags::APPEND),
|
||||
write: fs_rights_base.contains(Rights::FD_WRITE),
|
||||
read: fs_rights_base.contains(Rights::FD_READ),
|
||||
@@ -128,7 +128,7 @@ pub fn path_open<M: MemorySize>(
|
||||
},
|
||||
};
|
||||
|
||||
let parent_rights = wasmer_vfs::OpenOptionsConfig {
|
||||
let parent_rights = virtual_fs::OpenOptionsConfig {
|
||||
read: working_dir.rights.contains(Rights::FD_READ),
|
||||
write: working_dir.rights.contains(Rights::FD_WRITE),
|
||||
// The parent is a directory, which is why these options
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::f32::consts::E;
|
||||
|
||||
use wasmer_wasi_types::wasi::SubscriptionClock;
|
||||
use wasmer_wasix_types::wasi::SubscriptionClock;
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use wasmer_vfs::Pipe;
|
||||
use virtual_fs::Pipe;
|
||||
|
||||
use super::*;
|
||||
use crate::syscalls::*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use wasmer_wasi_types::wasi::{JoinFlags, JoinStatus, JoinStatusType, JoinStatusUnion, OptionPid};
|
||||
use wasmer_wasix_types::wasi::{JoinFlags, JoinStatus, JoinStatusType, JoinStatusUnion, OptionPid};
|
||||
|
||||
use super::*;
|
||||
use crate::syscalls::*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use wasmer_vfs::Pipe;
|
||||
use virtual_fs::Pipe;
|
||||
|
||||
use super::*;
|
||||
use crate::syscalls::*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use wasmer_vfs::AsyncReadExt;
|
||||
use virtual_fs::AsyncReadExt;
|
||||
|
||||
use super::*;
|
||||
use crate::{syscalls::*, WasiInodes};
|
||||
@@ -130,7 +130,7 @@ pub fn sock_send_file<M: MemorySize>(
|
||||
// TODO: optimize with MaybeUninit
|
||||
let mut buf = vec![0u8; sub_count as usize];
|
||||
let amt =
|
||||
wasmer_vfs::AsyncReadExt::read(pipe, &mut buf[..])
|
||||
virtual_fs::AsyncReadExt::read(pipe, &mut buf[..])
|
||||
.await
|
||||
.map_err(map_io_err)?;
|
||||
buf.truncate(amt);
|
||||
|
||||
@@ -2,7 +2,7 @@ use super::*;
|
||||
use crate::syscalls::*;
|
||||
|
||||
use wasmer::vm::VMMemory;
|
||||
use wasmer_wasi_types::wasi::ThreadStart;
|
||||
use wasmer_wasix_types::wasi::ThreadStart;
|
||||
|
||||
/// ### `thread_spawn()`
|
||||
/// Creates a new thread by spawning that shares the same
|
||||
|
||||
@@ -8,7 +8,7 @@ pub use self::dummy_waker::WasiDummyWaker;
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use wasmer::Module;
|
||||
use wasmer_wasi_types::wasi::Errno;
|
||||
use wasmer_wasix_types::wasi::Errno;
|
||||
|
||||
pub use self::thread_parker::WasiParkingLot;
|
||||
pub(crate) use owned_mutex_guard::{
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
use wasmer_vfs::FileSystem;
|
||||
use virtual_fs::FileSystem;
|
||||
|
||||
use tracing::*;
|
||||
#[allow(unused_imports)]
|
||||
@@ -364,7 +364,7 @@ where
|
||||
}
|
||||
|
||||
// Add the file system from the webc
|
||||
let webc_fs = wasmer_vfs::webc_fs::WebcFileSystem::init_all(ownership.clone());
|
||||
let webc_fs = virtual_fs::webc_fs::WebcFileSystem::init_all(ownership.clone());
|
||||
let top_level_dirs = webc_fs.top_level_dirs().clone();
|
||||
pck.webc_fs = Some(Arc::new(webc_fs));
|
||||
pck.webc_top_level_dirs = top_level_dirs;
|
||||
|
||||
@@ -4,13 +4,13 @@ use std::{path::Path, time::Duration};
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use reqwest::Client;
|
||||
use wasmer_wasi::runners::{Runner, WapmContainer};
|
||||
use wasmer_wasix::runners::{Runner, WapmContainer};
|
||||
|
||||
#[cfg(feature = "webc_runner_rt_wasi")]
|
||||
mod wasi {
|
||||
use tokio::runtime::Handle;
|
||||
use wasmer::Store;
|
||||
use wasmer_wasi::{
|
||||
use wasmer_wasix::{
|
||||
runners::wasi::WasiRunner, runtime::task_manager::tokio::TokioTaskManager, WasiError,
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@ mod wcgi {
|
||||
use futures::{channel::mpsc::Sender, future::AbortHandle, SinkExt, StreamExt};
|
||||
use rand::Rng;
|
||||
use tokio::runtime::Handle;
|
||||
use wasmer_wasi::{runners::wcgi::WcgiRunner, runtime::task_manager::tokio::TokioTaskManager};
|
||||
use wasmer_wasix::{runners::wcgi::WcgiRunner, runtime::task_manager::tokio::TokioTaskManager};
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -162,7 +162,7 @@ mod wcgi {
|
||||
handle: Handle,
|
||||
}
|
||||
|
||||
impl wasmer_wasi::runners::wcgi::Callbacks for Callbacks {
|
||||
impl wasmer_wasix::runners::wcgi::Callbacks for Callbacks {
|
||||
fn started(&self, abort: futures::stream::AbortHandle) {
|
||||
let mut sender = self.sender.clone();
|
||||
self.handle.spawn(async move {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use virtual_fs::{AsyncReadExt, AsyncWriteExt};
|
||||
use wasmer::{Module, Store};
|
||||
use wasmer_vfs::{AsyncReadExt, AsyncWriteExt};
|
||||
use wasmer_wasi::{Pipe, PluggableRuntimeImplementation, WasiEnv};
|
||||
use wasmer_wasix::{Pipe, PluggableRuntimeImplementation, WasiEnv};
|
||||
|
||||
mod sys {
|
||||
#[tokio::test]
|
||||
|
||||
@@ -13,8 +13,8 @@ edition = "2018"
|
||||
[dependencies]
|
||||
anyhow = "1.0"
|
||||
wasmer = { path = "../../../lib/api", version = "=3.2.0-alpha.1", default-features = false }
|
||||
wasmer-wasi = { path = "../../../lib/wasi", version = "=3.2.0-alpha.1" }
|
||||
wasmer-vfs = { path = "../../../lib/vfs", version = "=3.2.0-alpha.1" }
|
||||
wasmer-wasix = { path = "../../../lib/wasi", version = "0.1.0" }
|
||||
virtual-fs = { path = "../../../lib/vfs", version = "0.1.0" }
|
||||
wast = "38.0"
|
||||
serde = "1"
|
||||
tempfile = "3.4.0"
|
||||
|
||||
@@ -5,13 +5,13 @@ use std::path::{Path, PathBuf};
|
||||
use std::pin::Pin;
|
||||
use std::sync::{mpsc, Arc, Mutex};
|
||||
use std::task::{Context, Poll};
|
||||
use wasmer::{FunctionEnv, Imports, Module, Store};
|
||||
use wasmer_vfs::{
|
||||
use virtual_fs::{
|
||||
host_fs, mem_fs, passthru_fs, tmp_fs, union_fs, AsyncRead, AsyncSeek, AsyncWrite,
|
||||
AsyncWriteExt, FileSystem, Pipe, ReadBuf, RootFileSystemBuilder,
|
||||
};
|
||||
use wasmer_wasi::types::wasi::{Filesize, Timestamp};
|
||||
use wasmer_wasi::{
|
||||
use wasmer::{FunctionEnv, Imports, Module, Store};
|
||||
use wasmer_wasix::types::wasi::{Filesize, Timestamp};
|
||||
use wasmer_wasix::{
|
||||
generate_import_object_from_env, get_wasi_version, FsError, PluggableRuntimeImplementation,
|
||||
VirtualFile, WasiEnv, WasiEnvBuilder, WasiRuntime, WasiVersion,
|
||||
};
|
||||
@@ -20,22 +20,22 @@ use wast::parser::{self, Parse, ParseBuffer, Parser};
|
||||
/// The kind of filesystem `WasiTest` is going to use.
|
||||
#[derive(Debug)]
|
||||
pub enum WasiFileSystemKind {
|
||||
/// Instruct the test runner to use `wasmer_vfs::host_fs`.
|
||||
/// Instruct the test runner to use `virtual_fs::host_fs`.
|
||||
Host,
|
||||
|
||||
/// Instruct the test runner to use `wasmer_vfs::mem_fs`.
|
||||
/// Instruct the test runner to use `virtual_fs::mem_fs`.
|
||||
InMemory,
|
||||
|
||||
/// Instruct the test runner to use `wasmer_vfs::tmp_fs`
|
||||
/// Instruct the test runner to use `virtual_fs::tmp_fs`
|
||||
Tmp,
|
||||
|
||||
/// Instruct the test runner to use `wasmer_vfs::passtru_fs`
|
||||
/// Instruct the test runner to use `virtual_fs::passtru_fs`
|
||||
PassthruMemory,
|
||||
|
||||
/// Instruct the test runner to use `wasmer_vfs::union_fs<host_fs, mem_fs>`
|
||||
/// Instruct the test runner to use `virtual_fs::union_fs<host_fs, mem_fs>`
|
||||
UnionHostMemory,
|
||||
|
||||
/// Instruct the test runner to use the TempFs returned by `wasmer_vfs::builder::RootFileSystemBuilder`
|
||||
/// Instruct the test runner to use the TempFs returned by `virtual_fs::builder::RootFileSystemBuilder`
|
||||
RootFileSystemBuilder,
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ impl AsyncRead for OutputCapturerer {
|
||||
}
|
||||
}
|
||||
|
||||
/// When using `wasmer_vfs::mem_fs`, we cannot rely on `BASE_TEST_DIR`
|
||||
/// When using `virtual_fs::mem_fs`, we cannot rely on `BASE_TEST_DIR`
|
||||
/// because the host filesystem cannot be used. Instead, we are
|
||||
/// copying `BASE_TEST_DIR` to the `mem_fs`.
|
||||
fn map_host_fs_to_mem_fs<'a>(
|
||||
|
||||
Reference in New Issue
Block a user