diff --git a/lib/emscripten/src/env/unix/mod.rs b/lib/emscripten/src/env/unix/mod.rs index 5c4ef3d3a..cc7e01b03 100644 --- a/lib/emscripten/src/env/unix/mod.rs +++ b/lib/emscripten/src/env/unix/mod.rs @@ -1,15 +1,14 @@ /// NOTE: These syscalls only support wasm_32 for now because they take u32 offset use libc::{ - c_int, c_long, getenv, getgrnam as libc_getgrnam, getpwnam as libc_getpwnam, putenv, setenv, - sysconf, unsetenv, + c_int, getenv, getgrnam as libc_getgrnam, getpwnam as libc_getpwnam, putenv, setenv, sysconf, + unsetenv, }; use std::ffi::CStr; use std::mem; use std::os::raw::c_char; use crate::env::call_malloc; -use crate::utils::{allocate_on_stack, copy_cstr_into_wasm, copy_terminated_array_of_cstrs}; -use crate::EmscriptenData; +use crate::utils::{copy_cstr_into_wasm, copy_terminated_array_of_cstrs}; use wasmer_runtime_core::vm::Ctx; // #[no_mangle] diff --git a/lib/emscripten/src/lib.rs b/lib/emscripten/src/lib.rs index 999addb2e..df0a0da6c 100644 --- a/lib/emscripten/src/lib.rs +++ b/lib/emscripten/src/lib.rs @@ -1,29 +1,20 @@ #[macro_use] extern crate wasmer_runtime_core; -use byteorder::{ByteOrder, LittleEndian}; -use libc::c_int; use std::cell::UnsafeCell; -use std::{f64, ffi::c_void, fmt, mem, ptr}; +use std::{f64, ffi::c_void}; use wasmer_runtime_core::{ error::CallResult, - export::{Context, Export, FuncPointer}, + export::Export, func, global::Global, - import::{ImportObject, Namespace}, + import::ImportObject, imports, memory::Memory, table::Table, - types::{ - ElementType, FuncSig, GlobalDescriptor, MemoryDescriptor, TableDescriptor, - Type::{self, *}, - Value, - }, + types::{ElementType, MemoryDescriptor, TableDescriptor, Value}, units::Pages, vm::Ctx, - vm::LocalGlobal, - vm::LocalMemory, - vm::LocalTable, Func, Instance, Module, }; diff --git a/lib/emscripten/src/stdio.rs b/lib/emscripten/src/stdio.rs index e3909f4c9..d7d8ab736 100644 --- a/lib/emscripten/src/stdio.rs +++ b/lib/emscripten/src/stdio.rs @@ -12,7 +12,7 @@ pub struct StdioCapturer { } #[cfg(not(target_os = "windows"))] -use libc::{STDERR_FILENO, STDIN_FILENO, STDOUT_FILENO}; +use libc::{STDERR_FILENO, STDOUT_FILENO}; #[cfg(target_os = "windows")] const STDIN_FILENO: libc::c_int = 0; diff --git a/lib/emscripten/src/syscalls/mod.rs b/lib/emscripten/src/syscalls/mod.rs index 38c4157d1..c722e3a79 100644 --- a/lib/emscripten/src/syscalls/mod.rs +++ b/lib/emscripten/src/syscalls/mod.rs @@ -16,48 +16,30 @@ use byteorder::{ByteOrder, LittleEndian}; /// NOTE: TODO: These syscalls only support wasm_32 for now because they assume offsets are u32 /// Syscall list: https://www.cs.utexas.edu/~bismith/test/syscalls/syscalls32.html use libc::{ - accept, - bind, // ENOTTY, - c_char, c_int, c_void, chdir, // fcntl, setsockopt, getppid close, - connect, dup2, exit, fstat, - getpeername, getpid, - getsockname, - getsockopt, // iovec, - listen, lseek, - mkdir, - off_t, open, read, // readv, - recvfrom, rmdir, // writev, - sendto, - setsockopt, - sockaddr, - socket, - ssize_t, stat, write, - EINVAL, // sockaddr_in, }; use wasmer_runtime_core::vm::Ctx; use super::env; -use std::mem; use std::slice; // use std::sys::fd::FileDesc; diff --git a/lib/emscripten/src/syscalls/unix.rs b/lib/emscripten/src/syscalls/unix.rs index 766f78b92..c95c8c7dd 100644 --- a/lib/emscripten/src/syscalls/unix.rs +++ b/lib/emscripten/src/syscalls/unix.rs @@ -1,5 +1,4 @@ use crate::varargs::VarArgs; -use byteorder::{ByteOrder, LittleEndian}; /// NOTE: TODO: These syscalls only support wasm_32 for now because they assume offsets are u32 /// Syscall list: https://www.cs.utexas.edu/~bismith/test/syscalls/syscalls32.html use libc::{ @@ -9,39 +8,28 @@ use libc::{ c_char, c_int, c_void, - chdir, chown, // fcntl, setsockopt, getppid - close, connect, dup2, - exit, fcntl, - fstat, getgid, getpeername, - getpid, getsockname, getsockopt, - gid_t, in_addr_t, in_port_t, ioctl, // iovec, listen, - lseek, mkdir, msghdr, - off_t, - open, pid_t, pread, pwrite, - read, // readv, recvfrom, recvmsg, - rmdir, // ENOTTY, rusage, sa_family_t, @@ -54,11 +42,8 @@ use libc::{ sockaddr, socket, socklen_t, - ssize_t, - stat, uname, utsname, - write, EINVAL, // sockaddr_in, FIOCLEX, @@ -71,9 +56,7 @@ use libc::{ }; use wasmer_runtime_core::vm::Ctx; -use super::env; use std::mem; -use std::slice; // Linking to functions that are not provided by rust libc #[cfg(target_os = "macos")] diff --git a/lib/emscripten/src/time.rs b/lib/emscripten/src/time.rs index 8386a36ae..7efb22e15 100644 --- a/lib/emscripten/src/time.rs +++ b/lib/emscripten/src/time.rs @@ -1,11 +1,14 @@ use super::utils::{copy_cstr_into_wasm, write_to_buf}; -use libc::{c_char, c_int, time_t}; +use libc::{c_char, c_int}; use std::mem; use std::time::SystemTime; #[cfg(not(target_os = "windows"))] use libc::{clockid_t, time as libc_time}; +#[cfg(target_os = "windows")] +use libc::time_t; + #[cfg(target_os = "windows")] type clockid_t = c_int; diff --git a/lib/emscripten/src/utils.rs b/lib/emscripten/src/utils.rs index 92d51cf25..82ab0f251 100644 --- a/lib/emscripten/src/utils.rs +++ b/lib/emscripten/src/utils.rs @@ -2,10 +2,8 @@ use super::env; use super::env::get_emscripten_data; use libc::stat; use std::ffi::CStr; -use std::ffi::CString; use std::mem::size_of; use std::os::raw::c_char; -use std::os::raw::c_int; use std::slice; use wasmer_runtime_core::memory::Memory; use wasmer_runtime_core::{