From 680b833e9474a26a241e5abb1c7b5d07f0b99295 Mon Sep 17 00:00:00 2001 From: Syrus Date: Sun, 7 Jul 2019 23:36:50 -0700 Subject: [PATCH] Move emscripten ___syscall221 to the unix implementation --- lib/emscripten/src/syscalls/mod.rs | 20 -------------------- lib/emscripten/src/syscalls/unix.rs | 18 ++++++++++++++++++ lib/emscripten/src/syscalls/windows.rs | 6 ++++++ 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/lib/emscripten/src/syscalls/mod.rs b/lib/emscripten/src/syscalls/mod.rs index 58ee32b07..8c1b0a43a 100644 --- a/lib/emscripten/src/syscalls/mod.rs +++ b/lib/emscripten/src/syscalls/mod.rs @@ -24,7 +24,6 @@ use libc::{ close, dup2, exit, - fcntl, fstat, getpid, // readlink, @@ -596,25 +595,6 @@ pub fn ___syscall218(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { -1 } -// fcntl64 -pub fn ___syscall221(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int { - debug!("emscripten::___syscall221 (fcntl64) {}", _which); - // fcntl64 - let fd: i32 = varargs.get(ctx); - let cmd: i32 = varargs.get(ctx); - let arg: i32 = varargs.get(ctx); - // (FAPPEND - 0x08 - // |FASYNC - 0x40 - // |FFSYNC - 0x80 - // |FNONBLOCK - 0x04 - let ret = unsafe { fcntl(fd, cmd, arg) }; - debug!("=> fd: {}, cmd: {} = {}", fd, cmd, ret); - if ret == -1 { - debug!("=> last os error: {}", Error::last_os_error(),); - } - ret -} - pub fn ___syscall268(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { debug!("emscripten::___syscall268"); -1 diff --git a/lib/emscripten/src/syscalls/unix.rs b/lib/emscripten/src/syscalls/unix.rs index 4a4b98cae..6a0b4d988 100644 --- a/lib/emscripten/src/syscalls/unix.rs +++ b/lib/emscripten/src/syscalls/unix.rs @@ -1076,6 +1076,24 @@ pub fn ___syscall220(ctx: &mut Ctx, _which: i32, mut varargs: VarArgs) -> i32 { pos as i32 } +// fcntl64 +pub fn ___syscall221(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int { + debug!("emscripten::___syscall221 (fcntl64) {}", _which); + let fd: i32 = varargs.get(ctx); + let cmd: i32 = varargs.get(ctx); + let arg: i32 = varargs.get(ctx); + // (FAPPEND - 0x08 + // |FASYNC - 0x40 + // |FFSYNC - 0x80 + // |FNONBLOCK - 0x04 + let ret = unsafe { fcntl(fd, cmd, arg) }; + debug!("=> fd: {}, cmd: {} = {}", fd, cmd, ret); + if ret == -1 { + debug!("=> last os error: {}", Error::last_os_error(),); + } + ret +} + /// fallocate pub fn ___syscall324(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int { debug!("emscripten::___syscall324 (fallocate) {}", _which); diff --git a/lib/emscripten/src/syscalls/windows.rs b/lib/emscripten/src/syscalls/windows.rs index 296d51814..a04a978d2 100644 --- a/lib/emscripten/src/syscalls/windows.rs +++ b/lib/emscripten/src/syscalls/windows.rs @@ -291,6 +291,12 @@ pub fn ___syscall220(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { -1 } +// fcntl64 +pub fn ___syscall221(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int { + debug!("emscripten::___syscall221 (fcntl64) {}", _which); + -1 +} + /// fchown pub fn ___syscall207(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall207 (fchown) {}", _which);