mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-18 19:31:22 +00:00
add preopened fd and fix/improve fs syscalls (WIP)
This commit is contained in:
@ -17,7 +17,11 @@ pub use self::utils::is_wasi_module;
|
||||
|
||||
use wasmer_runtime_core::{func, import::ImportObject, imports};
|
||||
|
||||
pub fn generate_import_object(args: Vec<Vec<u8>>, envs: Vec<Vec<u8>>) -> ImportObject {
|
||||
pub fn generate_import_object(
|
||||
args: Vec<Vec<u8>>,
|
||||
envs: Vec<Vec<u8>>,
|
||||
preopened_files: Vec<String>,
|
||||
) -> ImportObject {
|
||||
let state_gen = move || {
|
||||
fn state_destructor(data: *mut c_void) {
|
||||
unsafe {
|
||||
@ -26,7 +30,7 @@ pub fn generate_import_object(args: Vec<Vec<u8>>, envs: Vec<Vec<u8>>) -> ImportO
|
||||
}
|
||||
|
||||
let state = Box::new(WasiState {
|
||||
fs: WasiFs::new().unwrap(),
|
||||
fs: WasiFs::new(&preopened_files).unwrap(),
|
||||
args: &args[..],
|
||||
envs: &envs[..],
|
||||
});
|
||||
|
Reference in New Issue
Block a user