wasi-c2: rewrite wasi-common in terms of system-interface

This commit is contained in:
Pat Hickey
2020-11-17 15:23:26 -08:00
parent efe7f37542
commit b87908de9b
11 changed files with 801 additions and 1 deletions

26
crates/wasi-c2/src/ctx.rs Normal file
View File

@@ -0,0 +1,26 @@
use crate::table::Table;
use std::cell::{RefCell, RefMut};
use std::rc::Rc;
pub struct WasiCtx {
table: Rc<RefCell<Table>>,
}
impl WasiCtx {
pub fn new() -> Self {
WasiCtx {
table: Rc::new(RefCell::new(Table::new())),
}
}
pub fn table(&self) -> RefMut<Table> {
self.table.borrow_mut()
}
}
pub trait WasiDir {}
pub(crate) struct DirEntry {
pub(crate) flags: u32,
pub(crate) dir: Box<dyn WasiDir>,
}