Skip to content

Commit

Permalink
Merge pull request #10 from CraneStation/api
Browse files Browse the repository at this point in the history
Add experimental struct with views into memory and ctx
  • Loading branch information
sunfishcode authored May 11, 2019
2 parents 328b8f3 + 75ad92b commit a200b21
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 214 deletions.
12 changes: 0 additions & 12 deletions src/ctx.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::fdentry::FdEntry;
use crate::host;
use crate::wasm32;

use failure::{bail, format_err, Error};
use nix::unistd::dup;
Expand All @@ -11,17 +10,6 @@ use std::io::{stderr, stdin, stdout};
use std::os::unix::prelude::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use std::path::{Path, PathBuf};

pub trait VmContext {
fn as_wasi_ctx(&self) -> *const WasiCtx;
fn as_wasi_ctx_mut(&mut self) -> *mut WasiCtx;

unsafe fn dec_ptr(
&mut self,
ptr: wasm32::uintptr_t,
len: usize,
) -> Result<*mut u8, host::__wasi_errno_t>;
}

pub struct WasiCtxBuilder {
fds: HashMap<host::__wasi_fd_t, FdEntry>,
preopens: HashMap<PathBuf, File>,
Expand Down
Loading

0 comments on commit a200b21

Please sign in to comment.