Commit Graph

48 Commits

Author SHA1 Message Date
Jakub Konka
2941c2022f Refactor wasmtime-wasi crate
Changes:
* uses Rust edition 2018
* returns wasm32 errno directly rather than relying on
  wasi_common::{host, memory} modules
* wraps extraction of memory and WASI context in a macro
2019-09-05 17:35:12 -07:00
Artur Jamro
fad70eb8bb Refactor usage of SecondaryMap impls (serde, PartialEq) 2019-09-05 17:14:32 -07:00
Dan Gohman
d4f27dcc91 Update Cargo.toml metadata for publishing. 2019-08-20 23:28:54 -07:00
Dan Gohman
44367ba99a Bump version to 0.2.0 2019-08-20 16:07:57 -07:00
Dan Gohman
36b4ff8031 Say "memory" instead of "__wasi_memory" in error messages.
While the "__wasi_memory" name is something we considered, the name
currently being used for the memory exported to WASI is "memory", so
adjust the error message accordingly.
2019-08-08 21:17:59 +02:00
Jakub Konka
085d700cdc Bump wasi-common rev 2019-08-08 11:06:27 +02:00
Yury Delendik
5fc2d827b7 Update cranelift requirement from 0.37.0 to 0.38.0 (#254)
closes #248, closes #249, closes #250, closes #251, closes #252
2019-08-06 14:49:28 -05:00
Till Schneidereit
41f88745c4 Update log and libc crates (#240)
* Update log crate

* Update libc crate
2019-08-06 09:01:52 -05:00
Yury Delendik
0bc9d1fe6f Update cranelift to 0.37.0 (#236)
Closed #228, #227, #226, #225, #224
2019-08-01 20:46:34 -05:00
Artur Jamro
165dc4944d Simple module compilation cache (#203)
* Simple module compilation cache

* Fix base64 encoding bug

* Use warn! everywhere in cache system

* Remove unused import

* Temporary workaround for long path on Windows

* Remove unused import for non-windows builds

* Add command line argument to enable cache system + apply minor review feedback
2019-07-25 16:16:10 -07:00
Stefan Junker
1aff03a5b4 dependencies: pin wasi-common to specific rev
This removes the reliance on having a correct version of wasi-common in
the cache by chance ;-)
2019-07-23 13:24:32 -07:00
Jakub Konka
1531fabf43 Update wasmtime-wasi to new wasi-common interface 2019-07-15 15:36:12 -07:00
Dan Gohman
1a10f4a002 Update to Cranelift 1.33 and require Rust 1.35.
Cranelift requires Rust 1.35; update accordingly.
2019-07-03 11:16:55 -07:00
Yury Delendik
fb9d6061e4 Update cranelift, faerie, target-lexicon and wasmparser deps 2019-07-02 14:07:30 -07:00
Dan Gohman
06b6ec42b9 Provide the C WASI implementation as an option.
This adds the C WASI implementation as a new crate, wasmtime-wasi-c,
and adds a command-line flag to the wasmtime command-line driver to
select which WASI implementation to use.
2019-06-03 13:23:07 -07:00
Jakub Konka
d57fbc7d0c Sync with wasi-common 2019-06-03 13:23:07 -07:00
Jakub Konka
e8142f076d Migrate to wasi-common crate 2019-06-03 13:23:07 -07:00
Dan Gohman
3dfeab50ad Don't add the NULL terminator to argv and environ arrays.
The wasm userspace has been updated to do that instead, in
https://github.com/CraneStation/wasi-sysroot/pull/72.
2019-06-02 08:54:51 +02:00
Dan Gohman
b5f4949597 Avoid using C features which depends on _Generic. 2019-05-27 10:13:33 -07:00
Dan Gohman
1882fc41bb Build sandboxed-system-primitives with -std=gnu99. 2019-05-27 09:14:29 -07:00
Dan Gohman
f486d61629 Make use of static_assert conditional on whether it's available. 2019-05-27 09:07:04 -07:00
Dan Gohman
176538b860 Support GCC and clang versions that lack <stdatomic.h>.
Add a code path to use the GCC builtins for atomics, which are supported
in older compiler versions, rather than the new <stdatomic.h>.
2019-05-27 07:48:18 +02:00
Dan Gohman
106c8c4cb6 Remove the polyfill from the master branch.
The polyfill now lives on the polyfill branch. Add a README.md file
pointing to the new location.
2019-05-18 15:40:30 -07:00
Will Scott
1320b111eb fix guest iovs pointer mapping 2019-05-18 15:31:14 -07:00
Dan Gohman
67edb00f29 Use getrandom rather than getentropy on Linux for random_get.
getentropy is limited to 256 bytes, so switch to getrandom.
2019-05-15 11:44:45 -07:00
Zhuowei Zhang
ca8c8b3370 js-polyfill: support Safari, which doesn't have instantiateStreaming 2019-05-10 14:24:59 -07:00
Jakub Konka
3e94af81df Add Rust impl of wasmtime_ssp_fd_prestat_dir_name 2019-05-07 13:20:55 -07:00
Jakub Konka
d6b2faeeb4 Modify fd_prestat to hold C-str together with its length 2019-05-01 15:32:28 -07:00
Jakub Konka
f7245f40a1 Port host::__wasi_preopentype_t to Rust 2019-05-01 15:32:28 -07:00
Jakub Konka
5c555406ca Add Rust impl of wasmtime_ssp_fd_prestat_get
In more detail, this commit:
* makes fd_prestat_get safe
* rewrites fd_prestats_get_entry in (safe) Rust
* creates helper macros for rwlock read lock and unlock
2019-05-01 15:32:28 -07:00
Dan Gohman
b0eab7398d Don't decode the incoming events to poll_oneoff. (#113)
The events array is an output-only array, so we don't need to decode its
contents.
2019-04-30 06:42:48 -07:00
Dan Gohman
ce3c0d98d3 Don't rewrite EBUSY to EINVAL in path_rename. 2019-04-29 23:36:21 -07:00
Dan Gohman
049c926e08 Handle set-size rights correctly when truncating a file.
If a path_open call is requesting __WASI_RIGHT_FD_FILESTAT_SET_SIZE,
interpret that as a request for write privleges. If it is requesting
O_TRUNC, require __WASI_RIGHT_PATH_FILESTAT_SET_SIZE, since this is
a path operation rather than a FD operation.
2019-04-29 23:34:34 -07:00
Dan Gohman
e62607e552 When path_open fails, set the output fd to -1. 2019-04-29 23:34:13 -07:00
Jakub Konka
86b7a52009 Port host::__wasi_errno_t errors to Rust
They are now blacklisted in the bindgen.
2019-04-29 23:33:40 -07:00
Jakub Konka
a51ffb6b6d Add Rust impl of wasmtime_ssp_sched_yield
Also, add Rust implementation of errno and convert_errno.
2019-04-29 23:33:40 -07:00
Jakub Konka
69e44caa29 Add Rust impl of wasmtime_ssp_proc_exit 2019-04-27 09:06:41 -07:00
Dan Gohman
e906370661 Make path_open return ELOOP on O_NOFOLLOW|O_DIRECTORY on a symlink. 2019-04-26 14:09:12 -07:00
Dan Gohman
f10cd2f4b1 Don't allow a preopened file descriptor to be renamed over.
This is consistent with fd_close's behavior, and is likely temporary
until other options are designed.
2019-04-26 13:06:42 -07:00
Dan Gohman
7813cc9d2d Fix a trace logging message. 2019-04-23 12:08:06 -07:00
Dan Gohman
7e11511abd Remove dead code. 2019-04-07 05:31:57 -07:00
Dan Gohman
07b83c5db3 Add __WASI_RIGHT_PATH_FILESTAT_SET_SIZE to RIGHTS_DIRECTORY_BASE.
This is a new right not present in CloudABI, which is why the code
previously didn't include it.
2019-04-05 15:09:14 -07:00
Dan Gohman
cc5efeb54d WASI: Simplify byref translation.
Avoid needlessly copying data from wasm into the host for output
parameters, and factor out the `.unwrap()` for translating pointers
when writing to output parameters.
2019-04-01 15:55:40 -07:00
Dan Gohman
5b77f95284 WASI: Implement translation for events and subscriptions. 2019-04-01 15:55:40 -07:00
Dan Gohman
7151c110d7 Implement decode/encode for __wasi_filestat_t. 2019-04-01 13:35:43 -07:00
Dan Gohman
dd0d71b18f Fix name name mangling of WASI functions in the JS polyfill.
Emscripten prefixes C functions with '_', so these functions end up
having 3 leading underscores.
2019-04-01 12:48:13 -07:00
Dan Gohman
7378a0bfbe Update Travis from trusty to xenial. (#84)
* Update Travis from trusty to xenial.

* Don't use getentropy on GLIBC < 2.25.
2019-03-31 05:46:32 -07:00
Dan Gohman
b2fefe7714 WASI prototype design, implementation, and documentation.
This adds documents describing the WASI Core API, and an implementation in
Wasmtime.
2019-03-27 10:58:43 -07:00