Enable wasi-common by default (#177)
This removes the --wasi-common, as it's now on by default, and adds a --wasi-c option to enable the wasi-c implementation.
This commit is contained in:
committed by
Till Schneidereit
parent
d900a5f6ef
commit
c0ba4753eb
@@ -31,6 +31,7 @@ wasmtime-jit = { path = "wasmtime-jit" }
|
|||||||
wasmtime-obj = { path = "wasmtime-obj" }
|
wasmtime-obj = { path = "wasmtime-obj" }
|
||||||
wasmtime-wast = { path = "wasmtime-wast" }
|
wasmtime-wast = { path = "wasmtime-wast" }
|
||||||
wasmtime-wasi = { path = "wasmtime-wasi" }
|
wasmtime-wasi = { path = "wasmtime-wasi" }
|
||||||
|
wasmtime-wasi-c = { path = "wasmtime-wasi-c", optional = true }
|
||||||
wasi-common = { git = "https://github.com/CraneStation/wasi-common" }
|
wasi-common = { git = "https://github.com/CraneStation/wasi-common" }
|
||||||
docopt = "1.0.1"
|
docopt = "1.0.1"
|
||||||
serde = "1.0.75"
|
serde = "1.0.75"
|
||||||
@@ -43,10 +44,8 @@ wabt = "0.7"
|
|||||||
libc = "0.2.50"
|
libc = "0.2.50"
|
||||||
errno = "0.2.4"
|
errno = "0.2.4"
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
|
||||||
wasmtime-wasi-c = { path = "wasmtime-wasi-c" }
|
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
lightbeam = ["wasmtime-environ/lightbeam", "wasmtime-jit/lightbeam"]
|
lightbeam = ["wasmtime-environ/lightbeam", "wasmtime-jit/lightbeam"]
|
||||||
|
wasi-c = ["wasmtime-wasi-c"]
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ use wasmtime_jit::{ActionOutcome, Context};
|
|||||||
use wasmtime_wasi::instantiate_wasi;
|
use wasmtime_wasi::instantiate_wasi;
|
||||||
use wasmtime_wast::instantiate_spectest;
|
use wasmtime_wast::instantiate_spectest;
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(feature = "wasi-c")]
|
||||||
use wasmtime_wasi_c::instantiate_wasi_c;
|
use wasmtime_wasi_c::instantiate_wasi_c;
|
||||||
|
|
||||||
static LOG_FILENAME_PREFIX: &str = "wasmtime.dbg.";
|
static LOG_FILENAME_PREFIX: &str = "wasmtime.dbg.";
|
||||||
@@ -66,8 +66,8 @@ including calling the start function if one is present. Additional functions
|
|||||||
given with --invoke are then called.
|
given with --invoke are then called.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
wasmtime [-odg] [--wasi-common] [--preload=<wasm>...] [--env=<env>...] [--dir=<dir>...] [--mapdir=<mapping>...] <file> [<arg>...]
|
wasmtime [-odg] [--wasi-c] [--preload=<wasm>...] [--env=<env>...] [--dir=<dir>...] [--mapdir=<mapping>...] <file> [<arg>...]
|
||||||
wasmtime [-odg] [--wasi-common] [--preload=<wasm>...] [--env=<env>...] [--dir=<dir>...] [--mapdir=<mapping>...] --invoke=<fn> <file> [<arg>...]
|
wasmtime [-odg] [--wasi-c] [--preload=<wasm>...] [--env=<env>...] [--dir=<dir>...] [--mapdir=<mapping>...] --invoke=<fn> <file> [<arg>...]
|
||||||
wasmtime --help | --version
|
wasmtime --help | --version
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@@ -75,7 +75,7 @@ Options:
|
|||||||
-o, --optimize runs optimization passes on the translated functions
|
-o, --optimize runs optimization passes on the translated functions
|
||||||
-g generate debug information
|
-g generate debug information
|
||||||
-d, --debug enable debug output on stderr/stdout
|
-d, --debug enable debug output on stderr/stdout
|
||||||
--wasi-common enable the wasi-common implementation of WASI
|
--wasi-c enable the wasi-c implementation of WASI
|
||||||
--preload=<wasm> load an additional wasm module before loading the main module
|
--preload=<wasm> load an additional wasm module before loading the main module
|
||||||
--env=<env> pass an environment variable (\"key=value\") to the program
|
--env=<env> pass an environment variable (\"key=value\") to the program
|
||||||
--dir=<dir> grant access to the given host directory
|
--dir=<dir> grant access to the given host directory
|
||||||
@@ -97,7 +97,7 @@ struct Args {
|
|||||||
flag_env: Vec<String>,
|
flag_env: Vec<String>,
|
||||||
flag_dir: Vec<String>,
|
flag_dir: Vec<String>,
|
||||||
flag_mapdir: Vec<String>,
|
flag_mapdir: Vec<String>,
|
||||||
flag_wasi_common: bool,
|
flag_wasi_c: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_to_end(path: PathBuf) -> Result<Vec<u8>, io::Error> {
|
fn read_to_end(path: PathBuf) -> Result<Vec<u8>, io::Error> {
|
||||||
@@ -235,17 +235,17 @@ fn main() {
|
|||||||
let argv = compute_argv(&args.arg_file, &args.arg_arg);
|
let argv = compute_argv(&args.arg_file, &args.arg_arg);
|
||||||
let environ = compute_environ(&args.flag_env);
|
let environ = compute_environ(&args.flag_env);
|
||||||
|
|
||||||
let wasi = if args.flag_wasi_common {
|
let wasi = if args.flag_wasi_c {
|
||||||
instantiate_wasi("", global_exports, &preopen_dirs, &argv, &environ)
|
#[cfg(feature = "wasi-c")]
|
||||||
} else {
|
|
||||||
#[cfg(unix)]
|
|
||||||
{
|
{
|
||||||
instantiate_wasi_c("", global_exports, &preopen_dirs, &argv, &environ)
|
instantiate_wasi_c("", global_exports, &preopen_dirs, &argv, &environ)
|
||||||
}
|
}
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(feature = "wasi-c"))]
|
||||||
{
|
{
|
||||||
unimplemented!("wasmtime-wasi-c requires a *nix")
|
panic!("wasi-c feature not enabled at build time")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
instantiate_wasi("", global_exports, &preopen_dirs, &argv, &environ)
|
||||||
}
|
}
|
||||||
.expect("instantiating wasi");
|
.expect("instantiating wasi");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user