build on windows

This commit is contained in:
Mackenzie Clark
2019-03-27 16:06:42 -07:00
parent 931008b5bd
commit 074013648e
6 changed files with 19 additions and 9 deletions

View File

@ -34,13 +34,13 @@ pub fn printf(_ctx: &mut Ctx, memory_offset: i32, extra: i32) -> i32 {
} }
/// chroot /// chroot
pub fn chroot(ctx: &mut Ctx, name_ptr: i32) -> i32 { pub fn chroot(_ctx: &mut Ctx, _name_ptr: i32) -> i32 {
debug!("emscripten::chroot"); debug!("emscripten::chroot");
unimplemented!() unimplemented!()
} }
/// getpwuid /// getpwuid
pub fn getpwuid(_ctx: &mut Ctx, uid: i32) -> i32 { pub fn getpwuid(_ctx: &mut Ctx, _uid: i32) -> i32 {
debug!("emscripten::getpwuid"); debug!("emscripten::getpwuid");
unimplemented!() unimplemented!()
} }

View File

@ -252,7 +252,7 @@ pub fn run_emscripten_instance(
// Construct a new virtual filesystem and inject it into the emscripten data // Construct a new virtual filesystem and inject it into the emscripten data
// This is behind a feature flag for now, but will be default in the future // This is behind a feature flag for now, but will be default in the future
#[cfg(not(feature = "vfs"))] #[cfg(any(not(feature = "vfs"), target_os = "windows"))]
let _ = module; let _ = module;
#[cfg(all(feature = "vfs", not(target_os = "windows")))] #[cfg(all(feature = "vfs", not(target_os = "windows")))]
{ {

View File

@ -20,7 +20,7 @@ pub fn ___syscall3(ctx: &mut Ctx, _which: i32, mut varargs: VarArgs) -> i32 {
let buf: u32 = varargs.get(ctx); let buf: u32 = varargs.get(ctx);
let count: i32 = varargs.get(ctx); let count: i32 = varargs.get(ctx);
debug!("=> fd: {}, buf_offset: {}, count: {}", fd, buf, count); debug!("=> fd: {}, buf_offset: {}, count: {}", fd, buf, count);
let buf_addr = emscripten_memory_pointer!(ctx.memory(0), buf) as *mut c_void; let buf_addr = emscripten_memory_pointer!(ctx.memory(0), buf) as *mut libc::c_void;
let ret = unsafe { libc::read(fd, buf_addr, count as _) }; let ret = unsafe { libc::read(fd, buf_addr, count as _) };
debug!("=> ret: {}", ret); debug!("=> ret: {}", ret);
ret as _ ret as _
@ -33,7 +33,7 @@ pub fn ___syscall4(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int
let buf: u32 = varargs.get(ctx); let buf: u32 = varargs.get(ctx);
let count: i32 = varargs.get(ctx); let count: i32 = varargs.get(ctx);
debug!("=> fd: {}, buf: {}, count: {}", fd, buf, count); debug!("=> fd: {}, buf: {}, count: {}", fd, buf, count);
let buf_addr = emscripten_memory_pointer!(ctx.memory(0), buf) as *const c_void; let buf_addr = emscripten_memory_pointer!(ctx.memory(0), buf) as *const libc::c_void;
let ret = unsafe { libc::write(fd, buf_addr, count as _) as i32 }; let ret = unsafe { libc::write(fd, buf_addr, count as _) as i32 };
ret ret
} }
@ -83,8 +83,16 @@ pub fn ___syscall5(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
} }
} }
/// close
pub fn ___syscall6(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall6 (close) {}", _which);
let fd: i32 = varargs.get(ctx);
debug!("fd: {}", fd);
unsafe { libc::close(fd) }
}
/// link /// link
pub fn ___syscall9(_ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int { pub fn ___syscall9(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall9 (link) {}", _which); debug!("emscripten::___syscall9 (link) {}", _which);
unimplemented!() unimplemented!()
} }
@ -156,13 +164,13 @@ pub fn ___syscall212(_ctx: &mut Ctx, which: c_int, mut _varargs: VarArgs) -> c_i
} }
/// access /// access
pub fn ___syscall33(_ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int { pub fn ___syscall33(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall33 (access) {}", _which); debug!("emscripten::___syscall33 (access) {}", _which);
unimplemented!() unimplemented!()
} }
/// nice /// nice
pub fn ___syscall34(_ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int { pub fn ___syscall34(_ctx: &mut Ctx, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall34 (nice) {}", _which); debug!("emscripten::___syscall34 (nice) {}", _which);
unimplemented!() unimplemented!()
} }

View File

@ -16,7 +16,7 @@ tar = "0.4"
wasmparser = "0.23.0" wasmparser = "0.23.0"
zstd = "0.4" zstd = "0.4"
[dependencies.zbox] [target.'cfg(unix)'.dependencies.zbox]
git = "https://github.com/wasmerio/zbox" git = "https://github.com/wasmerio/zbox"
branch = "bundle-libsodium" branch = "bundle-libsodium"
features = ["libsodium-bundled"] features = ["libsodium-bundled"]

View File

@ -1,4 +1,6 @@
#[cfg(not(target_os = "windows"))]
#[macro_use] #[macro_use]
extern crate failure; extern crate failure;
#[cfg(not(target_os = "windows"))]
pub mod vfs; pub mod vfs;

BIN
sqlite.wasm Normal file

Binary file not shown.