remove duplicated code, wrap WasmPtr on wasi side

This commit is contained in:
Mark McCaskey
2019-06-11 11:10:42 +02:00
parent 7965ed2746
commit b36783fc50
5 changed files with 72 additions and 110 deletions

View File

@ -10,7 +10,6 @@ pub use self::unix::*;
#[cfg(windows)]
pub use self::windows::*;
use crate::ptr::{Array, WasmPtr};
use crate::utils::{copy_stat_into_wasm, get_cstr_path, get_current_directory};
use super::varargs::VarArgs;
@ -42,7 +41,10 @@ use libc::{
write,
// readlink,
};
use wasmer_runtime_core::vm::Ctx;
use wasmer_runtime_core::{
memory::ptr::{Array, WasmPtr},
vm::Ctx,
};
use super::env;
use std::cell::Cell;
@ -282,7 +284,7 @@ pub fn ___syscall183(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> i32
buf_writer[i].set(byte as i8);
}
buf_writer[len].set(0);
buf_offset.offset()
buf_offset.offset() as i32
}
// mmap2