From 76b8738554a406a1c86849b37c1a5828895c951f Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Fri, 17 Jun 2022 19:45:50 +0200 Subject: [PATCH] Migrated Emscripten/Windows to new Context API --- lib/emscripten/src/env/windows/mod.rs | 52 ++++++++------- lib/emscripten/src/io/windows.rs | 9 +-- lib/emscripten/src/syscalls/windows.rs | 91 +++++++++++++------------- 3 files changed, 78 insertions(+), 74 deletions(-) diff --git a/lib/emscripten/src/env/windows/mod.rs b/lib/emscripten/src/env/windows/mod.rs index 6a587e1e0d1..dce90272874 100644 --- a/lib/emscripten/src/env/windows/mod.rs +++ b/lib/emscripten/src/env/windows/mod.rs @@ -8,7 +8,7 @@ use std::os::raw::c_char; use crate::env::{call_malloc, EmAddrInfo}; use crate::utils::{copy_cstr_into_wasm, read_string_from_wasm}; use crate::EmEnv; -use wasmer::WasmPtr; +use wasmer::{AsContextMut, ContextMut, WasmPtr}; extern "C" { #[link_name = "_putenv"] @@ -17,10 +17,10 @@ extern "C" { // #[no_mangle] /// emscripten: _getenv // (name: *const char) -> *const c_char; -pub fn _getenv(ctx: &EmEnv, name: u32) -> u32 { +pub fn _getenv(mut ctx: ContextMut<'_, EmEnv>, name: u32) -> u32 { debug!("emscripten::_getenv"); - let memory = ctx.memory(0); - let name_string = read_string_from_wasm(&memory, name); + let memory = ctx.data().memory(0); + let name_string = read_string_from_wasm(ctx.as_context_mut(), &memory, name); debug!("=> name({:?})", name_string); let c_str = unsafe { getenv(name_string.as_ptr() as *const libc::c_char) }; if c_str.is_null() { @@ -30,12 +30,12 @@ pub fn _getenv(ctx: &EmEnv, name: u32) -> u32 { } /// emscripten: _setenv // (name: *const char, name: *const value, overwrite: int); -pub fn _setenv(ctx: &EmEnv, name: u32, value: u32, _overwrite: u32) -> c_int { +pub fn _setenv(mut ctx: ContextMut<'_, EmEnv>, name: u32, value: u32, _overwrite: u32) -> c_int { debug!("emscripten::_setenv"); - let memory = ctx.memory(0); + let memory = ctx.data().memory(0); // setenv does not exist on windows, so we hack it with _putenv - let name = read_string_from_wasm(&memory, name); - let value = read_string_from_wasm(&memory, value); + let name = read_string_from_wasm(ctx.as_context_mut(), &memory, name); + let value = read_string_from_wasm(ctx, &memory, value); let putenv_string = format!("{}={}", name, value); let putenv_cstring = CString::new(putenv_string).unwrap(); let putenv_raw_ptr = putenv_cstring.as_ptr(); @@ -45,10 +45,10 @@ pub fn _setenv(ctx: &EmEnv, name: u32, value: u32, _overwrite: u32) -> c_int { } /// emscripten: _putenv // (name: *const char); -pub fn _putenv(ctx: &EmEnv, name: c_int) -> c_int { +pub fn _putenv(ctx: ContextMut<'_, EmEnv>, name: c_int) -> c_int { debug!("emscripten::_putenv"); - let memory = ctx.memory(0); - let name_addr = emscripten_memory_pointer!(&memory, name) as *const c_char; + let memory = ctx.data().memory(0); + let name_addr = emscripten_memory_pointer!(ctx, &memory, name) as *const c_char; debug!("=> name({:?})", unsafe { std::ffi::CStr::from_ptr(name_addr) }); @@ -56,10 +56,10 @@ pub fn _putenv(ctx: &EmEnv, name: c_int) -> c_int { } /// emscripten: _unsetenv // (name: *const char); -pub fn _unsetenv(ctx: &EmEnv, name: u32) -> c_int { +pub fn _unsetenv(ctx: ContextMut<'_, EmEnv>, name: u32) -> c_int { debug!("emscripten::_unsetenv"); - let memory = ctx.memory(0); - let name = read_string_from_wasm(&memory, name); + let memory = ctx.data().memory(0); + let name = read_string_from_wasm(ctx, &memory, name); // no unsetenv on windows, so use putenv with an empty value let unsetenv_string = format!("{}=", name); let unsetenv_cstring = CString::new(unsetenv_string).unwrap(); @@ -69,11 +69,11 @@ pub fn _unsetenv(ctx: &EmEnv, name: u32) -> c_int { } #[allow(clippy::cast_ptr_alignment)] -pub fn _getpwnam(ctx: &EmEnv, name_ptr: c_int) -> c_int { +pub fn _getpwnam(mut ctx: ContextMut<'_, EmEnv>, name_ptr: c_int) -> c_int { debug!("emscripten::_getpwnam {}", name_ptr); #[cfg(not(feature = "debug"))] let _ = name_ptr; - let memory = ctx.memory(0); + let memory = ctx.data().memory(0); #[repr(C)] struct GuestPasswd { @@ -88,9 +88,10 @@ pub fn _getpwnam(ctx: &EmEnv, name_ptr: c_int) -> c_int { // stub this in windows as it is not valid unsafe { - let passwd_struct_offset = call_malloc(ctx, mem::size_of::() as _); + let passwd_struct_offset = + call_malloc(ctx.as_context_mut(), mem::size_of::() as _); let passwd_struct_ptr = - emscripten_memory_pointer!(&memory, passwd_struct_offset) as *mut GuestPasswd; + emscripten_memory_pointer!(ctx, memory, passwd_struct_offset) as *mut GuestPasswd; (*passwd_struct_ptr).pw_name = 0; (*passwd_struct_ptr).pw_passwd = 0; (*passwd_struct_ptr).pw_gecos = 0; @@ -104,11 +105,11 @@ pub fn _getpwnam(ctx: &EmEnv, name_ptr: c_int) -> c_int { } #[allow(clippy::cast_ptr_alignment)] -pub fn _getgrnam(ctx: &EmEnv, name_ptr: c_int) -> c_int { +pub fn _getgrnam(mut ctx: ContextMut<'_, EmEnv>, name_ptr: c_int) -> c_int { debug!("emscripten::_getgrnam {}", name_ptr); #[cfg(not(feature = "debug"))] let _ = name_ptr; - let memory = ctx.memory(0); + let memory = ctx.data().memory(0); #[repr(C)] struct GuestGroup { @@ -120,9 +121,10 @@ pub fn _getgrnam(ctx: &EmEnv, name_ptr: c_int) -> c_int { // stub the group struct as it is not supported on windows unsafe { - let group_struct_offset = call_malloc(ctx, mem::size_of::() as _); + let group_struct_offset = + call_malloc(ctx.as_context_mut(), mem::size_of::() as _); let group_struct_ptr = - emscripten_memory_pointer!(&memory, group_struct_offset) as *mut GuestGroup; + emscripten_memory_pointer!(ctx, memory, group_struct_offset) as *mut GuestGroup; (*group_struct_ptr).gr_name = 0; (*group_struct_ptr).gr_passwd = 0; (*group_struct_ptr).gr_gid = 0; @@ -131,7 +133,7 @@ pub fn _getgrnam(ctx: &EmEnv, name_ptr: c_int) -> c_int { } } -pub fn _sysconf(_ctx: &EmEnv, name: c_int) -> c_long { +pub fn _sysconf(_ctx: ContextMut<'_, EmEnv>, name: c_int) -> c_long { debug!("emscripten::_sysconf {}", name); #[cfg(not(feature = "debug"))] let _ = name; @@ -139,13 +141,13 @@ pub fn _sysconf(_ctx: &EmEnv, name: c_int) -> c_long { 0 } -pub fn _gai_strerror(_ctx: &EmEnv, _ecode: i32) -> i32 { +pub fn _gai_strerror(_ctx: ContextMut<'_, EmEnv>, _ecode: i32) -> i32 { debug!("emscripten::_gai_strerror({}) - stub", _ecode); -1 } pub fn _getaddrinfo( - _ctx: &EmEnv, + _ctx: ContextMut<'_, EmEnv>, _node_ptr: WasmPtr, _service_str_ptr: WasmPtr, _hints_ptr: WasmPtr, diff --git a/lib/emscripten/src/io/windows.rs b/lib/emscripten/src/io/windows.rs index e0507ead876..0bd1d8fbc31 100644 --- a/lib/emscripten/src/io/windows.rs +++ b/lib/emscripten/src/io/windows.rs @@ -1,4 +1,5 @@ use crate::EmEnv; +use wasmer::ContextMut; // This may be problematic for msvc which uses inline functions for the printf family // this cfg_attr will try to link with the legacy lib that does not inline printf @@ -14,12 +15,12 @@ use crate::EmEnv; //} /// putchar -pub fn putchar(_ctx: &EmEnv, chr: i32) { +pub fn putchar(_ctx: ContextMut<'_, EmEnv>, chr: i32) { unsafe { libc::putchar(chr) }; } /// printf -pub fn printf(_ctx: &EmEnv, memory_offset: i32, extra: i32) -> i32 { +pub fn printf(_ctx: ContextMut<'_, EmEnv>, memory_offset: i32, extra: i32) -> i32 { debug!("emscripten::printf {}, {}", memory_offset, extra); #[cfg(not(feature = "debug"))] { @@ -34,13 +35,13 @@ pub fn printf(_ctx: &EmEnv, memory_offset: i32, extra: i32) -> i32 { } /// chroot -pub fn chroot(_ctx: &EmEnv, _name_ptr: i32) -> i32 { +pub fn chroot(_ctx: ContextMut<'_, EmEnv>, _name_ptr: i32) -> i32 { debug!("emscripten::chroot"); unimplemented!("emscripten::chroot") } /// getpwuid -pub fn getpwuid(_ctx: &EmEnv, _uid: i32) -> i32 { +pub fn getpwuid(_ctx: ContextMut<'_, EmEnv>, _uid: i32) -> i32 { debug!("emscripten::getpwuid"); unimplemented!("emscripten::getpwuid") } diff --git a/lib/emscripten/src/syscalls/windows.rs b/lib/emscripten/src/syscalls/windows.rs index 169b5f836f6..3c16821c940 100644 --- a/lib/emscripten/src/syscalls/windows.rs +++ b/lib/emscripten/src/syscalls/windows.rs @@ -8,26 +8,27 @@ use std::ffi::CString; use std::fs::File; use std::io::Write; use std::os::raw::c_int; +use wasmer::{AsContextMut, ContextMut}; #[allow(non_camel_case_types)] type pid_t = c_int; /// open -pub fn ___syscall5(ctx: &EmEnv, which: c_int, mut varargs: VarArgs) -> c_int { +pub fn ___syscall5(mut ctx: ContextMut<'_, EmEnv>, which: c_int, mut varargs: VarArgs) -> c_int { debug!("emscripten::___syscall5 (open) {}", which); #[cfg(not(feature = "debug"))] let _ = which; - let pathname_addr = varargs.get_str(ctx); - let real_path_owned = get_cstr_path(ctx, pathname_addr); + let pathname_addr = varargs.get_str(&ctx); + let real_path_owned = get_cstr_path(ctx.as_context_mut(), pathname_addr); let real_path = if let Some(ref rp) = real_path_owned { rp.as_c_str().as_ptr() } else { pathname_addr }; - let flags: i32 = varargs.get(ctx); - let mode: u32 = varargs.get(ctx); + let flags: i32 = varargs.get(&ctx); + let mode: u32 = varargs.get(&ctx); let path_str = unsafe { std::ffi::CStr::from_ptr(real_path).to_str().unwrap() }; - let memory = ctx.memory(0); + let memory = ctx.data().memory(0); match path_str { "/dev/urandom" => { @@ -44,9 +45,9 @@ pub fn ___syscall5(ctx: &EmEnv, which: c_int, mut varargs: VarArgs) -> c_int { getrandom::getrandom(&mut random_bytes).unwrap(); let _ = urandom_file.write_all(&random_bytes).unwrap(); // put the file path string into wasm memory - let urandom_file_offset = unsafe { copy_cstr_into_wasm(ctx, ptr) }; + let urandom_file_offset = unsafe { copy_cstr_into_wasm(ctx.as_context_mut(), ptr) }; let raw_pointer_to_urandom_file = - emscripten_memory_pointer!(&memory, urandom_file_offset) as *const i8; + emscripten_memory_pointer!(ctx, memory, urandom_file_offset) as *const i8; let fd = unsafe { open(raw_pointer_to_urandom_file, flags, mode) }; debug!( "=> pathname: {}, flags: {}, mode: {} = fd: {}", @@ -66,19 +67,19 @@ pub fn ___syscall5(ctx: &EmEnv, which: c_int, mut varargs: VarArgs) -> c_int { } /// link -pub fn ___syscall9(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall9(_ctx: ContextMut<'_, EmEnv>, _which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall9 (link) {}", _which); unimplemented!("emscripten::___syscall9 (link) {}", _which); } /// ftruncate64 -pub fn ___syscall194(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 { +pub fn ___syscall194(_ctx: ContextMut<'_, EmEnv>, _one: i32, _two: i32) -> i32 { debug!("emscripten::___syscall194 - stub"); unimplemented!("emscripten::___syscall194 - stub") } // chown -pub fn ___syscall212(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall212(_ctx: ContextMut<'_, EmEnv>, which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall212 (chown) {}", which); #[cfg(not(feature = "debug"))] let _ = which; @@ -86,23 +87,23 @@ pub fn ___syscall212(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int } /// access -pub fn ___syscall33(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall33(_ctx: ContextMut<'_, EmEnv>, _which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall33 (access) {}", _which); unimplemented!("emscripten::___syscall33 (access) {}", _which); } /// nice -pub fn ___syscall34(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall34(_ctx: ContextMut<'_, EmEnv>, _which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall34 (nice) {}", _which); unimplemented!("emscripten::___syscall34 (nice) {}", _which); } // mkdir -pub fn ___syscall39(ctx: &EmEnv, which: c_int, mut varargs: VarArgs) -> c_int { +pub fn ___syscall39(ctx: ContextMut<'_, EmEnv>, which: c_int, mut varargs: VarArgs) -> c_int { debug!("emscripten::___syscall39 (mkdir) {}", which); #[cfg(not(feature = "debug"))] let _ = which; - let pathname_addr = varargs.get_str(ctx); + let pathname_addr = varargs.get_str(&ctx); let real_path_owned = get_cstr_path(ctx, pathname_addr); let real_path = if let Some(ref rp) = real_path_owned { rp.as_c_str().as_ptr() @@ -113,80 +114,80 @@ pub fn ___syscall39(ctx: &EmEnv, which: c_int, mut varargs: VarArgs) -> c_int { } /// dup -pub fn ___syscall41(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall41(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall41 (dup) {}", _which); unimplemented!("emscripten::___syscall41 (dup) {}", _which); } /// getrusage -pub fn ___syscall77(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall77(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall77 (getrusage) {}", _which); unimplemented!("emscripten::___syscall77 (getrusage) {}", _which); } /// symlink -pub fn ___syscall83(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall83(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall83 (symlink) {}", _which); unimplemented!("emscripten::___syscall83 (symlink) {}", _which); } /// readlink -pub fn ___syscall85(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall85(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall85 (readlink) {}", _which); -1 } /// getpgid -pub fn ___syscall132(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall132(_ctx: ContextMut<'_, EmEnv>, _which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall132 (getpgid)"); -1 } /// lchown -pub fn ___syscall198(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall198(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall198 (lchown) {}", _which); unimplemented!("emscripten::___syscall198 (lchown) {}", _which); } /// getgid32 -pub fn ___syscall200(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 { +pub fn ___syscall200(_ctx: ContextMut<'_, EmEnv>, _one: i32, _two: i32) -> i32 { debug!("emscripten::___syscall200 (getgid32)"); unimplemented!("emscripten::___syscall200 (getgid32)"); } // geteuid32 -pub fn ___syscall201(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 { +pub fn ___syscall201(_ctx: ContextMut<'_, EmEnv>, _one: i32, _two: i32) -> i32 { debug!("emscripten::___syscall201 (geteuid32)"); unimplemented!("emscripten::___syscall201 (geteuid32)"); } // getegid32 -pub fn ___syscall202(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 { +pub fn ___syscall202(_ctx: ContextMut<'_, EmEnv>, _one: i32, _two: i32) -> i32 { // gid_t debug!("emscripten::___syscall202 (getegid32)"); unimplemented!("emscripten::___syscall202 (getegid32)"); } /// getgroups -pub fn ___syscall205(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall205(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall205 (getgroups) {}", _which); unimplemented!("emscripten::___syscall205 (getgroups) {}", _which); } /// madvise -pub fn ___syscall219(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall219(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall212 (chown) {}", _which); unimplemented!("emscripten::___syscall212 (chown) {}", _which); } /// dup3 -pub fn ___syscall330(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> pid_t { +pub fn ___syscall330(_ctx: ContextMut<'_, EmEnv>, _which: c_int, mut _varargs: VarArgs) -> pid_t { debug!("emscripten::___syscall330 (dup3)"); -1 } /// ioctl -pub fn ___syscall54(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall54(_ctx: ContextMut<'_, EmEnv>, which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall54 (ioctl) {}", which); #[cfg(not(feature = "debug"))] let _ = which; @@ -194,14 +195,14 @@ pub fn ___syscall54(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int } /// fchmod -pub fn ___syscall94(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall94(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall118 (fchmod) {}", _which); unimplemented!("emscripten::___syscall118 (fchmod) {}", _which); } // socketcall #[allow(clippy::cast_ptr_alignment)] -pub fn ___syscall102(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall102(_ctx: ContextMut<'_, EmEnv>, which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall102 (socketcall) {}", which); #[cfg(not(feature = "debug"))] let _ = which; @@ -209,13 +210,13 @@ pub fn ___syscall102(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int } /// fsync -pub fn ___syscall118(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall118(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall118 (fsync) {}", _which); unimplemented!("emscripten::___syscall118 (fsync) {}", _which); } // pread -pub fn ___syscall180(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall180(_ctx: ContextMut<'_, EmEnv>, which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall180 (pread) {}", which); #[cfg(not(feature = "debug"))] let _ = which; @@ -223,7 +224,7 @@ pub fn ___syscall180(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int } // pwrite -pub fn ___syscall181(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall181(_ctx: ContextMut<'_, EmEnv>, which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall181 (pwrite) {}", which); #[cfg(not(feature = "debug"))] let _ = which; @@ -232,14 +233,14 @@ pub fn ___syscall181(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int /// wait4 #[allow(clippy::cast_ptr_alignment)] -pub fn ___syscall114(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> pid_t { +pub fn ___syscall114(_ctx: ContextMut<'_, EmEnv>, _which: c_int, mut _varargs: VarArgs) -> pid_t { debug!("emscripten::___syscall114 (wait4)"); -1 } // select #[allow(clippy::cast_ptr_alignment)] -pub fn ___syscall142(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall142(_ctx: ContextMut<'_, EmEnv>, which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall142 (newselect) {}", which); #[cfg(not(feature = "debug"))] let _ = which; @@ -247,13 +248,13 @@ pub fn ___syscall142(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int } /// fdatasync -pub fn ___syscall148(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall148(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall148 (fdatasync) {}", _which); unimplemented!("emscripten::___syscall148 (fdatasync) {}", _which); } // setpgid -pub fn ___syscall57(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall57(_ctx: ContextMut<'_, EmEnv>, which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall57 (setpgid) {}", which); #[cfg(not(feature = "debug"))] let _ = which; @@ -262,7 +263,7 @@ pub fn ___syscall57(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int /// uname // NOTE: Wondering if we should return custom utsname, like Emscripten. -pub fn ___syscall122(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall122(_ctx: ContextMut<'_, EmEnv>, which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall122 (uname) {}", which); #[cfg(not(feature = "debug"))] let _ = which; @@ -270,43 +271,43 @@ pub fn ___syscall122(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int } /// poll -pub fn ___syscall168(_ctx: &EmEnv, _which: i32, _varargs: VarArgs) -> i32 { +pub fn ___syscall168(_ctx: ContextMut<'_, EmEnv>, _which: i32, _varargs: VarArgs) -> i32 { debug!("emscripten::___syscall168(poll) - stub"); -1 } /// lstat64 -pub fn ___syscall196(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 { +pub fn ___syscall196(_ctx: ContextMut<'_, EmEnv>, _one: i32, _two: i32) -> i32 { debug!("emscripten::___syscall196 (lstat64) - stub"); -1 } // getuid -pub fn ___syscall199(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 { +pub fn ___syscall199(_ctx: ContextMut<'_, EmEnv>, _one: i32, _two: i32) -> i32 { debug!("emscripten::___syscall199 (getuid)"); -1 } // getdents -pub fn ___syscall220(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 { +pub fn ___syscall220(_ctx: ContextMut<'_, EmEnv>, _one: i32, _two: i32) -> i32 { debug!("emscripten::___syscall220"); -1 } // fcntl64 -pub fn ___syscall221(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int { +pub fn ___syscall221(_ctx: ContextMut<'_, EmEnv>, _which: c_int, mut _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall221 (fcntl64) {}", _which); -1 } /// fchown -pub fn ___syscall207(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall207(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall207 (fchown) {}", _which); unimplemented!("emscripten::___syscall207 (fchown) {}", _which) } /// fallocate -pub fn ___syscall324(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int { +pub fn ___syscall324(_ctx: ContextMut<'_, EmEnv>, _which: c_int, _varargs: VarArgs) -> c_int { debug!("emscripten::___syscall324 (fallocate) {}", _which); unimplemented!("emscripten::___syscall324 (fallocate) {}", _which) }