From d464954f5803e4d84b6f94dc9ef87cc577aa9c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Legan=C3=A9s-Combarro=20=27piranna?= Date: Thu, 4 Jul 2019 07:04:36 +0200 Subject: [PATCH] [fcntl64] Replace mock for real implementation --- lib/emscripten/src/syscalls/mod.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/emscripten/src/syscalls/mod.rs b/lib/emscripten/src/syscalls/mod.rs index 2e9b39fd3..669ed8a9c 100644 --- a/lib/emscripten/src/syscalls/mod.rs +++ b/lib/emscripten/src/syscalls/mod.rs @@ -594,18 +594,19 @@ pub fn ___syscall218(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { 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: u32 = varargs.get(ctx); + 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 - debug!("=> fd: {}, cmd: {}", _fd, cmd); - match cmd { - 1 | 2 => 0, - 13 | 14 => 0, // pretend file locking worked - _ => -1, + 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 {