mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Merge
This commit is contained in:
commit
e63d7fd531
@ -103,7 +103,7 @@ jobs:
|
||||
- run:
|
||||
name: Install Rust
|
||||
command: |
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||
curl -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
cargo --version
|
||||
- run:
|
||||
@ -153,7 +153,8 @@ jobs:
|
||||
- run:
|
||||
name: "Pull dependencies"
|
||||
command: |
|
||||
git clone git@github.com:wasmerio/wapm-cli.git
|
||||
git submodule init
|
||||
git submodule update --remote
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v8-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
|
||||
@ -220,7 +221,8 @@ jobs:
|
||||
- run:
|
||||
name: "Pull dependencies"
|
||||
command: |
|
||||
git clone git@github.com:wasmerio/wapm-cli.git
|
||||
git submodule init
|
||||
git submodule update --remote
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v8-cargo-cache-darwin-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
|
||||
@ -238,7 +240,7 @@ jobs:
|
||||
- run:
|
||||
name: Install Rust
|
||||
command: |
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2019-04-11
|
||||
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
cargo --version
|
||||
# Use rust nightly (for singlepass, for now)
|
||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "wapm-cli"]
|
||||
path = wapm-cli
|
||||
url = https://github.com/wasmerio/wapm-cli.git
|
@ -5,6 +5,8 @@ All PRs to the Wasmer repository must add to this file.
|
||||
Blocks of changes will separated by version increments.
|
||||
|
||||
## **[Unreleased]**
|
||||
- [#397](https://github.com/wasmerio/wasmer/pull/397) Fix WASI fs abstraction to work on Windows
|
||||
- [#390](https://github.com/wasmerio/wasmer/pull/390) Pin released wapm version and add it as a git submodule
|
||||
- [#383](https://github.com/wasmerio/wasmer/pull/383) Hook up wasi exit code to wasmer cli.
|
||||
- [#382](https://github.com/wasmerio/wasmer/pull/382) Improve error message on `--backend` flag to only suggest currently enabled backends
|
||||
- [#381](https://github.com/wasmerio/wasmer/pull/381) Allow retrieving propagated user errors.
|
||||
|
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2414,7 +2414,6 @@ dependencies = [
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmer-runtime-core 0.3.0",
|
||||
"zbox 0.6.1 (git+https://github.com/wasmerio/zbox?branch=bundle-libsodium)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -5,7 +5,7 @@ use std::sync::Arc;
|
||||
use wasmer_runtime_core::{
|
||||
backend::{sys::Memory, CacheGen},
|
||||
cache::{Artifact, Error},
|
||||
module::{ModuleInfo, ModuleInner},
|
||||
module::ModuleInfo,
|
||||
structures::Map,
|
||||
types::{LocalFuncIndex, SigIndex},
|
||||
};
|
||||
|
@ -298,7 +298,7 @@ impl LLVMBackend {
|
||||
let callbacks = get_callbacks();
|
||||
let mut module: *mut LLVMModule = ptr::null_mut();
|
||||
|
||||
let slice = unsafe { memory.as_slice() };
|
||||
let slice = memory.as_slice();
|
||||
|
||||
let res = module_load(slice.as_ptr(), slice.len(), callbacks, &mut module);
|
||||
|
||||
@ -308,7 +308,7 @@ impl LLVMBackend {
|
||||
|
||||
static SIGNAL_HANDLER_INSTALLED: Once = Once::new();
|
||||
|
||||
SIGNAL_HANDLER_INSTALLED.call_once(|| unsafe {
|
||||
SIGNAL_HANDLER_INSTALLED.call_once(|| {
|
||||
crate::platform::install_signal_handler();
|
||||
});
|
||||
|
||||
|
@ -657,10 +657,3 @@ impl<'a> DynFunc<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
impl Instance {
|
||||
pub fn memory_offset_addr(&self, _: u32, _: usize) -> *const u8 {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,7 @@ use crate::{
|
||||
use hashbrown::HashMap;
|
||||
use std::fmt::Debug;
|
||||
use wasmparser::{
|
||||
BinaryReaderError, Data, DataKind, Element, ElementKind, Export, ExternalKind, FuncType,
|
||||
Import, ImportSectionEntryType, InitExpr, ModuleReader, Operator, SectionCode, Type as WpType,
|
||||
BinaryReaderError, ExternalKind, FuncType, ImportSectionEntryType, Operator, Type as WpType,
|
||||
WasmDecoder,
|
||||
};
|
||||
|
||||
|
@ -16,8 +16,3 @@ hashbrown = "0.1.8"
|
||||
generational-arena = "0.2.2"
|
||||
log = "0.4.6"
|
||||
byteorder = "1.3.1"
|
||||
|
||||
[dependencies.zbox]
|
||||
git = "https://github.com/wasmerio/zbox"
|
||||
branch = "bundle-libsodium"
|
||||
features = ["libsodium-bundled"]
|
||||
|
@ -9,45 +9,39 @@ use std::{
|
||||
cell::Cell,
|
||||
fs,
|
||||
io::{self, Read, Seek, Write},
|
||||
path::PathBuf,
|
||||
time::SystemTime,
|
||||
};
|
||||
use wasmer_runtime_core::debug;
|
||||
use zbox::init_env as zbox_init_env;
|
||||
|
||||
pub const MAX_SYMLINKS: usize = 100;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum WasiFile {
|
||||
#[allow(dead_code)]
|
||||
ZboxFile(zbox::File),
|
||||
HostFile(fs::File),
|
||||
}
|
||||
|
||||
impl Write for WasiFile {
|
||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||
match self {
|
||||
WasiFile::ZboxFile(zbf) => zbf.write(buf),
|
||||
WasiFile::HostFile(hf) => hf.write(buf),
|
||||
}
|
||||
}
|
||||
|
||||
fn flush(&mut self) -> io::Result<()> {
|
||||
match self {
|
||||
WasiFile::ZboxFile(zbf) => zbf.flush(),
|
||||
WasiFile::HostFile(hf) => hf.flush(),
|
||||
}
|
||||
}
|
||||
|
||||
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
|
||||
match self {
|
||||
WasiFile::ZboxFile(zbf) => zbf.write_all(buf),
|
||||
WasiFile::HostFile(hf) => hf.write_all(buf),
|
||||
}
|
||||
}
|
||||
|
||||
fn write_fmt(&mut self, fmt: ::std::fmt::Arguments) -> io::Result<()> {
|
||||
match self {
|
||||
WasiFile::ZboxFile(zbf) => zbf.write_fmt(fmt),
|
||||
WasiFile::HostFile(hf) => hf.write_fmt(fmt),
|
||||
}
|
||||
}
|
||||
@ -56,28 +50,24 @@ impl Write for WasiFile {
|
||||
impl Read for WasiFile {
|
||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||
match self {
|
||||
WasiFile::ZboxFile(zbf) => zbf.read(buf),
|
||||
WasiFile::HostFile(hf) => hf.read(buf),
|
||||
}
|
||||
}
|
||||
|
||||
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> {
|
||||
match self {
|
||||
WasiFile::ZboxFile(zbf) => zbf.read_to_end(buf),
|
||||
WasiFile::HostFile(hf) => hf.read_to_end(buf),
|
||||
}
|
||||
}
|
||||
|
||||
fn read_to_string(&mut self, buf: &mut String) -> io::Result<usize> {
|
||||
match self {
|
||||
WasiFile::ZboxFile(zbf) => zbf.read_to_string(buf),
|
||||
WasiFile::HostFile(hf) => hf.read_to_string(buf),
|
||||
}
|
||||
}
|
||||
|
||||
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
|
||||
match self {
|
||||
WasiFile::ZboxFile(zbf) => zbf.read_exact(buf),
|
||||
WasiFile::HostFile(hf) => hf.read_exact(buf),
|
||||
}
|
||||
}
|
||||
@ -86,7 +76,6 @@ impl Read for WasiFile {
|
||||
impl Seek for WasiFile {
|
||||
fn seek(&mut self, pos: io::SeekFrom) -> io::Result<u64> {
|
||||
match self {
|
||||
WasiFile::ZboxFile(zbf) => zbf.seek(pos),
|
||||
WasiFile::HostFile(hf) => hf.seek(pos),
|
||||
}
|
||||
}
|
||||
@ -150,7 +139,9 @@ pub enum Kind {
|
||||
handle: WasiFile,
|
||||
},
|
||||
Dir {
|
||||
handle: WasiFile,
|
||||
// TODO: wrap it like WasiFile
|
||||
/// The path on the host system where the directory is located
|
||||
path: PathBuf,
|
||||
/// The entries of a directory are lazily filled.
|
||||
entries: HashMap<String, Inode>,
|
||||
},
|
||||
@ -182,10 +173,7 @@ pub struct WasiFs {
|
||||
}
|
||||
|
||||
impl WasiFs {
|
||||
pub fn new(preopened_files: &[String]) -> Result<Self, String> {
|
||||
debug!("wasi::fs::init");
|
||||
zbox_init_env();
|
||||
debug!("wasi::fs::repo");
|
||||
pub fn new(preopened_dirs: &[String]) -> Result<Self, String> {
|
||||
/*let repo = RepoOpener::new()
|
||||
.create(true)
|
||||
.open("mem://wasmer-test-fs", "")
|
||||
@ -200,29 +188,26 @@ impl WasiFs {
|
||||
next_fd: Cell::new(3),
|
||||
inode_counter: Cell::new(1000),
|
||||
};
|
||||
for file in preopened_files {
|
||||
debug!("Attempting to preopen {}", &file);
|
||||
for dir in preopened_dirs {
|
||||
debug!("Attempting to preopen {}", &dir);
|
||||
// TODO: think about this
|
||||
let default_rights = 0x1FFFFFFF; // all rights
|
||||
let cur_file: fs::File = fs::OpenOptions::new()
|
||||
.read(true)
|
||||
.open(file)
|
||||
.expect("Could not find file");
|
||||
let cur_file_metadata = cur_file.metadata().unwrap();
|
||||
let kind = if cur_file_metadata.is_dir() {
|
||||
let cur_dir = PathBuf::from(dir);
|
||||
let cur_dir_metadata = cur_dir.metadata().expect("Could not find directory");
|
||||
let kind = if cur_dir_metadata.is_dir() {
|
||||
Kind::Dir {
|
||||
handle: WasiFile::HostFile(cur_file),
|
||||
path: cur_dir.clone(),
|
||||
entries: Default::default(),
|
||||
}
|
||||
} else {
|
||||
return Err(format!(
|
||||
"WASI only supports pre-opened directories right now; found \"{}\"",
|
||||
file
|
||||
&dir
|
||||
));
|
||||
};
|
||||
// TODO: handle nested pats in `file`
|
||||
let inode_val =
|
||||
InodeVal::from_file_metadata(&cur_file_metadata, file.clone(), true, kind);
|
||||
InodeVal::from_file_metadata(&cur_dir_metadata, dir.clone(), true, kind);
|
||||
|
||||
let inode = wasi_fs.inodes.insert(inode_val);
|
||||
wasi_fs.inodes[inode].stat.st_ino = wasi_fs.inode_counter.get();
|
||||
|
@ -1242,15 +1242,12 @@ pub fn path_open(
|
||||
};
|
||||
// TODO: handle __WASI_O_TRUNC on directories
|
||||
|
||||
let cur_dir = wasi_try!(open_options
|
||||
.open(&cumulative_path)
|
||||
.map_err(|_| __WASI_EINVAL));
|
||||
|
||||
// TODO: refactor and reuse
|
||||
let cur_file_metadata = cur_dir.metadata().unwrap();
|
||||
let cur_file_metadata =
|
||||
wasi_try!(cumulative_path.metadata().map_err(|_| __WASI_EINVAL));
|
||||
let kind = if cur_file_metadata.is_dir() {
|
||||
Kind::Dir {
|
||||
handle: WasiFile::HostFile(cur_dir),
|
||||
path: cumulative_path.clone(),
|
||||
entries: Default::default(),
|
||||
}
|
||||
} else {
|
||||
|
@ -1,8 +1,7 @@
|
||||
use cmake::Config;
|
||||
|
||||
fn main() {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
use cmake::Config;
|
||||
let project_name = "exception_handling";
|
||||
let dst = Config::new(project_name).build();
|
||||
println!("cargo:rustc-link-search=native={}", dst.display());
|
||||
|
1
wapm-cli
Submodule
1
wapm-cli
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c9399f3fb117c8ab1cbaf17b02bd5aeefb8e8e54
|
Loading…
Reference in New Issue
Block a user