mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-09 22:28:21 +00:00
Multiple changes required to implement the wasmer terminal on the browser
- Split functionality out of WasiEnv so that it can support multi-threading - Added methods to the VFS File Trait that supporting polling - Implemented basic time functionality for WASI - Incorported a yield callback for when WASI processes idle - Improved the error handling on WASI IO calls - Reduce the verbose logging on some critical WASI calls (write/read) - Implemented the missing poll functionality for WASI processes - Moved the syspoll functionality behind a feature flag to default to WASI method - Refactored the thread sleeping functionality for WASI processes - Fixed the files system benchmark which was not compiling - Modified the file system trait so that it is SYNC and thus can handle multiple threads - Removed the large mutex around filesystem state and implemented granular locks instead (this is needed to fix a deadlock scenario on the terminal) - Split the inodes object apart from the state to fix the deadlock scenario. - Few minor fixes to some warnings when not using certain features - Sleeping will now call a callback that can be used by the runtime operator when a WASI thread goes to sleep (for instance to do other work) - Fixed a bug where paths that exist on the real file system are leaking into VFS - Timing functions now properly return a time precision on WASI - Some improved macros for error handling within syscalls (wasi_try_ok!) - Refactored the remove_directory WASI function which was not working properly - Refactored the unlink WASI function which was not working properly - Refactored the poll WASI function which was not working properly - Updates some of the tests to make them compile again - Rewrote the OutputCapturer so that it does leak into the internals
This commit is contained in:
committed by
ptitSeb
parent
9af113ca86
commit
7c532813e7
@@ -19,7 +19,7 @@ use std::os::raw::c_char;
|
||||
use std::slice;
|
||||
use wasmer_api::{Exportable, Extern};
|
||||
use wasmer_wasi::{
|
||||
generate_import_object_from_env, get_wasi_version, WasiEnv, WasiFile, WasiState,
|
||||
generate_import_object_from_thread, get_wasi_version, WasiEnv, WasiFile, WasiState,
|
||||
WasiStateBuilder, WasiVersion,
|
||||
};
|
||||
|
||||
@@ -229,7 +229,8 @@ pub unsafe extern "C" fn wasi_env_read_stderr(
|
||||
) -> isize {
|
||||
let inner_buffer = slice::from_raw_parts_mut(buffer as *mut _, buffer_len as usize);
|
||||
let mut state = env.inner.state();
|
||||
let stderr = if let Ok(stderr) = state.fs.stderr_mut() {
|
||||
let inodes = state.inodes.write().unwrap();
|
||||
let stderr = if let Ok(stderr) = inodes.stderr_mut(&state.fs.fd_map) {
|
||||
if let Some(stderr) = stderr.as_mut() {
|
||||
stderr
|
||||
} else {
|
||||
@@ -345,7 +346,8 @@ fn wasi_get_imports_inner(
|
||||
let version = c_try!(get_wasi_version(&module.inner, false)
|
||||
.ok_or("could not detect a WASI version on the given module"));
|
||||
|
||||
let import_object = generate_import_object_from_env(store, wasi_env.inner.clone(), version);
|
||||
let mut thread = wasi_env.inner.new_thread();
|
||||
let import_object = generate_import_object_from_thread(store, thread, version);
|
||||
|
||||
imports.set_buffer(c_try!(module
|
||||
.inner
|
||||
|
||||
Reference in New Issue
Block a user