Added emscripten syscall20 implementation

This commit is contained in:
Syrus Akbary 2018-11-26 12:48:39 -08:00
parent 5911ac58c0
commit 5907bcc0f4
2 changed files with 16 additions and 2 deletions

View File

@ -190,6 +190,11 @@ pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> {
"___syscall221",
ImportValue::Func(syscalls::___syscall221 as *const u8),
);
import_object.set(
"env",
"___syscall20",
ImportValue::Func(syscalls::___syscall20 as *const u8),
);
// Process
import_object.set(
"env",
@ -295,6 +300,7 @@ pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> {
"_clock_gettime",
ImportValue::Func(time::_clock_gettime as _),
);
mock_external!(import_object, _waitpid);
mock_external!(import_object, _utimes);
mock_external!(import_object, _usleep);
@ -366,7 +372,7 @@ pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> {
mock_external!(import_object, ___syscall140);
mock_external!(import_object, ___syscall122);
mock_external!(import_object, ___syscall102);
mock_external!(import_object, ___syscall20);
// mock_external!(import_object, ___syscall20);
mock_external!(import_object, ___syscall15);
mock_external!(import_object, ___syscall10);

View File

@ -11,7 +11,7 @@ use libc::{
getsockname, getpeername,
sendto, recvfrom, setsockopt,
getsockopt, sendmsg, recvmsg,
msghdr,
msghdr, getpid, pid_t
};
use macros;
@ -244,3 +244,11 @@ pub extern "C" fn ___syscall102(_which: c_int, mut varargs: VarArgs, instance: &
},
}
}
// sys_getpid
pub extern "C" fn ___syscall20() -> pid_t {
debug!("emscripten::___syscall20");
unsafe {
getpid()
}
}