Implement WASI C API.

This commit implements an initial WASI C API that can be used to instantiate
and configure a WASI instance from C.

This also implements a `WasiBuilder` for the C# API enabling .NET hosts to bind
to Wasmtime's WASI implementation.
This commit is contained in:
Peter Huene
2020-02-07 11:24:26 -08:00
parent f8abe1169c
commit ae0b4090ce
28 changed files with 1303 additions and 268 deletions

View File

@@ -113,6 +113,27 @@ impl WasiCtxBuilder {
self
}
/// Inherit stdin from the host process.
pub fn inherit_stdin(mut self) -> Self {
self.fds
.insert(0, PendingFdEntry::Thunk(FdEntry::duplicate_stdin));
self
}
/// Inherit stdout from the host process.
pub fn inherit_stdout(mut self) -> Self {
self.fds
.insert(1, PendingFdEntry::Thunk(FdEntry::duplicate_stdout));
self
}
/// Inherit stdout from the host process.
pub fn inherit_stderr(mut self) -> Self {
self.fds
.insert(2, PendingFdEntry::Thunk(FdEntry::duplicate_stderr));
self
}
/// Inherit the stdin, stdout, and stderr streams from the host process.
pub fn inherit_stdio(mut self) -> Self {
self.fds