mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Added emscripten _signal, improved chdir implementation
This commit is contained in:
parent
a85e02fe6e
commit
0d3134c9fd
@ -306,6 +306,11 @@ pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> {
|
||||
"_sigaction",
|
||||
ImportValue::Func(signal::_sigaction as _),
|
||||
);
|
||||
import_object.set(
|
||||
"env",
|
||||
"_signal",
|
||||
ImportValue::Func(signal::_signal as _),
|
||||
);
|
||||
// Memory
|
||||
import_object.set(
|
||||
"env",
|
||||
|
@ -28,3 +28,8 @@ pub extern "C" fn _sigprocmask() -> i32 {
|
||||
debug!("emscripten::_sigprocmask");
|
||||
0
|
||||
}
|
||||
|
||||
pub extern "C" fn _signal(sig: u32, _instance: &mut Instance) -> i32 {
|
||||
debug!("emscripten::_signal ({})", sig);
|
||||
0
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ use libc::{
|
||||
select,
|
||||
FIONBIO,
|
||||
setpgid,
|
||||
chdir
|
||||
};
|
||||
|
||||
/// exit
|
||||
@ -134,13 +135,13 @@ pub extern "C" fn ___syscall12(
|
||||
) -> c_int {
|
||||
debug!("emscripten::___syscall12 (chdir)");
|
||||
let path_addr: i32 = varargs.get(instance);
|
||||
let _path = unsafe {
|
||||
unsafe {
|
||||
let path_ptr = instance.memory_offset_addr(0, path_addr as usize) as *const i8;
|
||||
let path = std::ffi::CStr::from_ptr(path_ptr).to_str().unwrap();
|
||||
debug!("=> path: {}", path);
|
||||
path
|
||||
};
|
||||
0
|
||||
let path = std::ffi::CStr::from_ptr(path_ptr);
|
||||
let ret = chdir(path_ptr);
|
||||
debug!("=> path: {:?}, ret: {}", path, ret);
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
// getpid
|
||||
|
Loading…
Reference in New Issue
Block a user