FIxed emscripten windows issues

This commit is contained in:
Syrus
2019-07-07 22:50:50 -07:00
parent 69be61c9cb
commit 72a80a6122
3 changed files with 23 additions and 17 deletions

View File

@ -26,13 +26,11 @@ use libc::{
exit, exit,
fcntl, fcntl,
fstat, fstat,
getpgid,
getpid, getpid,
// readlink, // readlink,
// iovec, // iovec,
lseek, lseek,
// open, // open,
pid_t,
read, read,
rename, rename,
// sockaddr_in, // sockaddr_in,
@ -311,19 +309,6 @@ pub fn ___syscall125(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
-1 -1
} }
pub fn ___syscall132(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall132 (getpgid)");
let pid: pid_t = varargs.get(ctx);
let ret = unsafe { getpgid(pid) };
debug!("=> pid: {} = {}", pid, ret);
if ret == -1 {
debug!("=> last os error: {}", Error::last_os_error(),);
}
ret
}
pub fn ___syscall133(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn ___syscall133(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall133"); debug!("emscripten::___syscall133");
-1 -1
@ -425,8 +410,8 @@ pub fn ___syscall140(ctx: &mut Ctx, _which: i32, mut varargs: VarArgs) -> i32 {
let offset_low: u32 = varargs.get(ctx); let offset_low: u32 = varargs.get(ctx);
let result_ptr_value: WasmPtr<i64> = varargs.get(ctx); let result_ptr_value: WasmPtr<i64> = varargs.get(ctx);
let whence: i32 = varargs.get(ctx); let whence: i32 = varargs.get(ctx);
let offset = offset_low as i64; let offset = offset_low;
let ret = unsafe { lseek(fd, offset, whence) as i64 }; let ret = unsafe { lseek(fd, offset as _, whence) as i64 };
let result_ptr = result_ptr_value.deref(ctx.memory(0)).unwrap(); let result_ptr = result_ptr_value.deref(ctx.memory(0)).unwrap();
result_ptr.set(ret); result_ptr.set(ret);

View File

@ -25,6 +25,7 @@ use libc::{
getgid, getgid,
getgroups, getgroups,
getpeername, getpeername,
getpgid,
getrusage, getrusage,
getsockname, getsockname,
getsockopt, getsockopt,
@ -804,6 +805,20 @@ fn translate_socket_name_flag(name: i32) -> i32 {
} }
} }
/// getpgid
pub fn ___syscall132(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall132 (getpgid)");
let pid: pid_t = varargs.get(ctx);
let ret = unsafe { getpgid(pid) };
debug!("=> pid: {} = {}", pid, ret);
if ret == -1 {
debug!("=> last os error: {}", Error::last_os_error(),);
}
ret
}
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone)]
#[repr(C)] #[repr(C)]
pub struct EmPollFd { pub struct EmPollFd {

View File

@ -134,6 +134,12 @@ pub fn ___syscall85(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
-1 -1
} }
/// getpgid
pub fn ___syscall132(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall132 (getpgid)");
-1
}
/// lchown /// lchown
pub fn ___syscall198(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int { pub fn ___syscall198(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall198 (lchown) {}", _which); debug!("emscripten::___syscall198 (lchown) {}", _which);