mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-08 05:38:19 +00:00
"config" -> "wasi_config"
This commit is contained in:
@@ -636,7 +636,7 @@ pub unsafe extern "C" fn wasi_config_new(
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wasi_config_env(
|
pub unsafe extern "C" fn wasi_config_env(
|
||||||
config: &mut wasi_config_t,
|
wasi_config: &mut wasi_config_t,
|
||||||
key: *const c_char,
|
key: *const c_char,
|
||||||
value: *const c_char,
|
value: *const c_char,
|
||||||
) {
|
) {
|
||||||
@@ -648,22 +648,22 @@ pub unsafe extern "C" fn wasi_config_env(
|
|||||||
let value_cstr = CStr::from_ptr(value);
|
let value_cstr = CStr::from_ptr(value);
|
||||||
let value_bytes = value_cstr.to_bytes();
|
let value_bytes = value_cstr.to_bytes();
|
||||||
|
|
||||||
config.state_builder.env(key_bytes, value_bytes);
|
wasi_config.state_builder.env(key_bytes, value_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wasi_config_arg(config: &mut wasi_config_t, arg: *const c_char) {
|
pub unsafe extern "C" fn wasi_config_arg(wasi_config: &mut wasi_config_t, arg: *const c_char) {
|
||||||
debug_assert!(!arg.is_null());
|
debug_assert!(!arg.is_null());
|
||||||
|
|
||||||
let arg_cstr = CStr::from_ptr(arg);
|
let arg_cstr = CStr::from_ptr(arg);
|
||||||
let arg_bytes = arg_cstr.to_bytes();
|
let arg_bytes = arg_cstr.to_bytes();
|
||||||
|
|
||||||
config.state_builder.arg(arg_bytes);
|
wasi_config.state_builder.arg(arg_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wasi_config_preopen_dir(
|
pub unsafe extern "C" fn wasi_config_preopen_dir(
|
||||||
config: &mut wasi_config_t,
|
wasi_config: &mut wasi_config_t,
|
||||||
dir: *const c_char,
|
dir: *const c_char,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let dir_cstr = CStr::from_ptr(dir);
|
let dir_cstr = CStr::from_ptr(dir);
|
||||||
@@ -676,7 +676,7 @@ pub unsafe extern "C" fn wasi_config_preopen_dir(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) = config.state_builder.preopen_dir(dir_str) {
|
if let Err(e) = wasi_config.state_builder.preopen_dir(dir_str) {
|
||||||
update_last_error(e);
|
update_last_error(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -686,7 +686,7 @@ pub unsafe extern "C" fn wasi_config_preopen_dir(
|
|||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wasi_config_mapdir(
|
pub unsafe extern "C" fn wasi_config_mapdir(
|
||||||
config: &mut wasi_config_t,
|
wasi_config: &mut wasi_config_t,
|
||||||
alias: *const c_char,
|
alias: *const c_char,
|
||||||
dir: *const c_char,
|
dir: *const c_char,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
@@ -710,7 +710,7 @@ pub unsafe extern "C" fn wasi_config_mapdir(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Err(e) = config.state_builder.map_dir(alias_str, dir_str) {
|
if let Err(e) = wasi_config.state_builder.map_dir(alias_str, dir_str) {
|
||||||
update_last_error(e);
|
update_last_error(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -719,33 +719,33 @@ pub unsafe extern "C" fn wasi_config_mapdir(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wasi_config_capture_stdout(config: &mut wasi_config_t) {
|
pub extern "C" fn wasi_config_capture_stdout(wasi_config: &mut wasi_config_t) {
|
||||||
config.stdout = Some(unsafe { Box::from_raw(wasi_pipe_new_null()) });
|
wasi_config.stdout = Some(unsafe { Box::from_raw(wasi_pipe_new_null()) });
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wasi_config_inherit_stdout(config: &mut wasi_config_t) {
|
pub extern "C" fn wasi_config_inherit_stdout(wasi_config: &mut wasi_config_t) {
|
||||||
config.stdout = None;
|
wasi_config.stdout = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wasi_config_capture_stderr(config: &mut wasi_config_t) {
|
pub extern "C" fn wasi_config_capture_stderr(wasi_config: &mut wasi_config_t) {
|
||||||
config.stderr = Some(unsafe { Box::from_raw(wasi_pipe_new_null()) });
|
wasi_config.stderr = Some(unsafe { Box::from_raw(wasi_pipe_new_null()) });
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wasi_config_inherit_stderr(config: &mut wasi_config_t) {
|
pub extern "C" fn wasi_config_inherit_stderr(wasi_config: &mut wasi_config_t) {
|
||||||
config.stderr = None;
|
wasi_config.stderr = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wasi_config_capture_stdin(config: &mut wasi_config_t) {
|
pub extern "C" fn wasi_config_capture_stdin(wasi_config: &mut wasi_config_t) {
|
||||||
config.stdin = Some(unsafe { Box::from_raw(wasi_pipe_new_null()) });
|
wasi_config.stdin = Some(unsafe { Box::from_raw(wasi_pipe_new_null()) });
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wasi_config_inherit_stdin(config: &mut wasi_config_t) {
|
pub extern "C" fn wasi_config_inherit_stdin(wasi_config: &mut wasi_config_t) {
|
||||||
config.stdin = None;
|
wasi_config.stdin = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
@@ -791,24 +791,24 @@ pub struct wasi_env_t {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn wasi_env_new(
|
pub unsafe extern "C" fn wasi_env_new(
|
||||||
store: Option<&mut wasm_store_t>,
|
store: Option<&mut wasm_store_t>,
|
||||||
mut config: Box<wasi_config_t>,
|
mut wasi_config: Box<wasi_config_t>,
|
||||||
) -> Option<Box<wasi_env_t>> {
|
) -> Option<Box<wasi_env_t>> {
|
||||||
let store = &mut store?.inner;
|
let store = &mut store?.inner;
|
||||||
let mut store_mut = store.store_mut();
|
let mut store_mut = store.store_mut();
|
||||||
|
|
||||||
if let Some(stdout) = config.stdout {
|
if let Some(stdout) = wasi_config.stdout {
|
||||||
config.state_builder.stdout(stdout);
|
wasi_config.state_builder.stdout(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(stderr) = config.stderr {
|
if let Some(stderr) = wasi_config.stderr {
|
||||||
config.state_builder.stderr(stderr);
|
wasi_config.state_builder.stderr(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(stdin) = config.stdin {
|
if let Some(stdin) = wasi_config.stdin {
|
||||||
config.state_builder.stdin(stdin);
|
wasi_config.state_builder.stdin(stdin);
|
||||||
}
|
}
|
||||||
|
|
||||||
let wasi_state = c_try!(config.state_builder.finalize(&mut store_mut));
|
let wasi_state = c_try!(wasi_config.state_builder.finalize(&mut store_mut));
|
||||||
|
|
||||||
Some(Box::new(wasi_env_t {
|
Some(Box::new(wasi_env_t {
|
||||||
inner: wasi_state,
|
inner: wasi_state,
|
||||||
|
|||||||
Reference in New Issue
Block a user