Added ___syscall57 emscripten syscall

This commit is contained in:
Syrus Akbary 2018-12-01 11:33:17 -08:00
parent d1c8d34270
commit a85e02fe6e
2 changed files with 21 additions and 1 deletions

View File

@ -271,6 +271,11 @@ pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> {
"___syscall142",
ImportValue::Func(syscalls::___syscall142 as _),
);
import_object.set(
"env",
"___syscall57",
ImportValue::Func(syscalls::___syscall57 as _),
);
// Process
import_object.set("env", "abort", ImportValue::Func(process::em_abort as _));

View File

@ -52,6 +52,7 @@ use libc::{
writev,
select,
FIONBIO,
setpgid,
};
/// exit
@ -728,4 +729,18 @@ pub extern "C" fn ___syscall142(
let writefds_ptr = instance.memory_offset_addr(0, writefds as _) as _;
unsafe { select(nfds, readfds_ptr, writefds_ptr, 0 as _, 0 as _) }
}
}
// setpgid
pub extern "C" fn ___syscall57(
_which: c_int,
mut varargs: VarArgs,
instance: &mut Instance,
) -> c_int {
debug!("emscripten::___syscall57 (setpgid)");
let pid: i32 = varargs.get(instance);
let pgid: i32 = varargs.get(instance);
unsafe {
setpgid(pid, pgid)
}
}