Extract common interface from lucet-wasi

This commit is contained in:
Jakub Konka
2019-05-04 14:28:22 +02:00
commit cd39c1dfd8
13 changed files with 4574 additions and 0 deletions

44
README.md Normal file
View File

@@ -0,0 +1,44 @@
# wasi-common
This repo strips away those bits of [lucet-wasi](https://github.com/fastly/lucet/tree/master/lucet-wasi)
which can potentially be encapsulated in a separated crate with potential plug'n'play use in both
[Lucet](https://github.com/fastly/lucet)
and [Wasmtime](https://github.com/CraneStation/wasmtime) projects.
This repo is strictly experimental.
## Supported syscalls
We support a subset of the [WASI
API](https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md), though we are adding
new syscalls on a regular basis. We currently implement:
- `__wasi_args_get`
- `__wasi_args_sizes_get`
- `__wasi_clock_res_get`
- `__wasi_clock_time_get`
- `__wasi_environ_get`
- `__wasi_environ_sizes_get`
- `__wasi_fd_close`
- `__wasi_fd_fdstat_get`
- `__wasi_fd_fdstat_set_flags`
- `__wasi_fd_prestat_dir_name`
- `__wasi_fd_prestat_get`
- `__wasi_fd_read`
- `__wasi_fd_seek`
- `__wasi_fd_write`
- `__wasi_path_open`
- `__wasi_proc_exit`
- `__wasi_random_get`
This is enough to run basic C and Rust programs, including those that use command-line arguments,
environment variables, stdio, and basic file operations.
## Third-Party Code
`src/wasm32.rs` is copied from
[wasmtime](https://github.com/CraneStation/wasmtime/blob/master/wasmtime-wasi/src/wasm32.rs), along
with the associated `LICENSE.wasmtime` file.
Significant parts of our syscall implementations are derived from the C implementations in
`cloudabi-utils`. See `LICENSE.cloudabi-utils` for license information.