Commit Graph

222 Commits

Author SHA1 Message Date
Joshua Warner
d947010181 Don't implicitly create empty files in VirtualDir::openat (#2235)
* Don't implicitly create empty files in VirtualDir::openat

* Add test

* Add note on how to run test-program tests to the README
2020-09-25 19:52:13 -07:00
Alex Crichton
5e08eb3b83 Bump wasmtime to 0.20.0 (#2222)
At the same time bump cranelift crates to 0.67.0
2020-09-23 13:54:02 -05:00
Pat Hickey
b72d5de86c virtfs: import types from handle, drop types:: prefix 2020-09-14 16:42:20 -07:00
Pat Hickey
4763678be2 sys: import types from handle or sched, not wasi. drop types:: prefix. 2020-09-14 16:42:20 -07:00
Pat Hickey
e5129b39cb path: import types from handle rather than wasi 2020-09-14 16:42:20 -07:00
Pat Hickey
e47927f0fd fs: only import wasi Fd type in one place 2020-09-14 16:42:20 -07:00
Pat Hickey
83c1fa1b8b entry: import types from handle 2020-09-14 16:42:20 -07:00
Pat Hickey
5639881519 ctx: import Fd without any types:: prefix 2020-09-14 16:42:20 -07:00
Pat Hickey
66ba582bba sched: re-export the wasi types used for times and events 2020-09-14 16:42:20 -07:00
Pat Hickey
6db24fd08f handle: re-export all of the wasi types used by handles 2020-09-14 16:42:20 -07:00
Pat Hickey
1d410d6559 move more constructor stuff into stringarray 2020-09-02 17:16:39 -07:00
Pat Hickey
39f1c9716c restructure StringArrayWriter trait into StringArray struct 2020-09-02 14:11:32 -07:00
Pat Hickey
ddd50f7443 fix error report 2020-09-02 13:13:13 -07:00
Pat Hickey
51d88f7899 wasi-common: move implementation of args, env methods into StringArrayWriter 2020-09-01 13:50:31 -07:00
Pat Hickey
87222d6db0 wasi-common: move GuestPtr deref out of path::get 2020-09-01 13:50:30 -07:00
Pat Hickey
20ccc11564 Merge pull request #2140 from bytecodealliance/pch/wasi_error_handling
wasi-common: refactor error types
2020-09-01 13:01:26 -07:00
Pat Hickey
22b427baa0 use WASI_ROOT env var to specify witx paths to wiggle macros 2020-08-28 15:42:51 -07:00
Pat Hickey
393581b2ae Merge branch 'main' into pch/wasi_error_handling 2020-08-26 17:26:03 -07:00
Pat Hickey
7e750845cd Remove unnecessary check - fixed in std since Rust 1.38
issue now closed: https://github.com/rust-lang/rust/issues/63326
fix landed in a rollup: https://github.com/rust-lang/rust/pull/63380 merged aug 8, 2019
rust 1.38 beta cut on aug 15, 2019: https://blog.rust-lang.org/2019/08/15/Rust-1.37.0.html
minimum supported rust version for this repo is currently 1.41.
2020-08-25 17:27:47 -07:00
Pat Hickey
02aba548e1 Merge remote-tracking branch 'origin/main' into pch/wasi_error_handling 2020-08-25 15:22:51 -07:00
Pat Hickey
5e0ca3c13b tracing: some windows fixes 2020-08-25 11:32:24 -07:00
Pat Hickey
930912f783 tracing fixes in unix poll; add some missing debug impls 2020-08-25 11:29:34 -07:00
Pat Hickey
963fe37eea Update crates/wasi-common/src/sys/windows/path.rs
Co-authored-by: iximeow <git@iximeow.net>
2020-08-25 11:17:08 -07:00
Pat Hickey
fceea4e7d2 Update crates/wasi-common/src/sys/unix/mod.rs
Co-authored-by: iximeow <git@iximeow.net>
2020-08-25 11:16:48 -07:00
Pat Hickey
530ea50c82 wasi-common: dep on getrandom requires std 2020-08-19 15:10:04 -07:00
Pat Hickey
e8c01ddef1 put getrandom::Error into Error 2020-08-19 14:29:14 -07:00
Pat Hickey
c1aec81b84 add enough errno variants to cover all windows codes too 2020-08-19 12:03:38 -07:00
Pat Hickey
4535741d01 refactor when we translate io::Error to an Error
* a certain subset of io::Errors are expected - these we have
  a (platform-specific, because windows) method to translate into
  one of the wasi errno variants in the Error enum.
* some io::Errors are unexpected - wasi-common doesnt expect them from
  the underlying OS. rather than preserve any fidelity in reporting
  those to the user (only the unix impl attempts this), lets collect
  those as an `Error::UnexpectedIo(#[source] std::io::Error)`.
  Rather than trace at the conversion site, we rely on the wiggle error
  conversion hooks to trace the `Error`'s `Debug` impl, and then
  we convert all of these unexpected into `Errno::Io` for returning
  to the guest.

This is a different behavior from before, and I don't have any firm
guarantees that nobody was depending on the old behavior, but it
appears to me that none of those unexpected errnos were reasonable
to expect from any of the filesystem syscalls wasi-common is making.
2020-08-19 11:32:59 -07:00
Pat Hickey
9286bb8f08 hmm this code is challenging 2020-08-18 16:22:15 -07:00
Pat Hickey
e08173da9e fix windows: Error is not Copy like Errno is 2020-08-18 16:11:59 -07:00
Pat Hickey
94f904449b fix yanix 2020-08-18 16:02:53 -07:00
Pat Hickey
c4fbec6387 additional windows fix 2020-08-18 15:02:54 -07:00
Pat Hickey
73aef4c6ca guess i forgot a lot of these that dont build on linux 2020-08-18 15:01:04 -07:00
Pat Hickey
3bc1f84c9d windows: success fixes 2020-08-18 11:31:08 -07:00
Pat Hickey
4be3b06b61 switch from log::debug to tracing::debug
this duplicates work done in #2139 on code that moves from
where the switch took place in that PR.
2020-08-18 10:55:42 -07:00
Pat Hickey
e8160c9a6b redefine crate to use Error everywhere except in wasi 2020-08-18 10:50:17 -07:00
Pat Hickey
b8409dd9aa wasi-common: define an Error type for the crate 2020-08-18 10:50:17 -07:00
Pat Hickey
19369142cb wasi-common: trace and convert error
this is a bug - the TODO was never resolved, even when the code to
implement it was added right below :)

tracing is already in the transitive deps via wiggle, so no extra
trouble there. tracing::debug is more appropriate than eprintln
2020-08-18 10:50:17 -07:00
Pat Hickey
0e1c534e07 wasi-common: fix some warnings 2020-08-18 10:46:14 -07:00
Pat Hickey
94ee96712a wasi-common: switch all logs from log to tracing
tracing is already the dep that wiggle uses.

I used tracing structured arguments wherever I could, but I skipped over
it in all of the snapshot_0 code, because I'm going to delete that code
and replace it with wiggle-based stuff real soon.
2020-08-18 10:46:14 -07:00
Pat Hickey
19e2a46aaf bump to latest wasi submodule
witx is now 0.8.6.
2020-08-17 15:58:56 -07:00
Daiki Ueno
e70f73211d virtfs file: update cursor position on fd_read (#2070)
* virtfs file: update cursor position on fd_read

If a handle is backed by InMemoryFile, fd_read (turned into
Handle::read_vectored) doesn't update the cursor position properly and
thus prevents the caller from detecting EOF.

* virtfs file: fd_{pread,pwrite}: update offset in iovec iteration

If multiple iovec's are supplied, fd_pread and fd_pwrite previously
access data at the same offset for each iovec.
2020-07-29 14:19:17 +02:00
Dan Gohman
4c15a4daf2 Use AsRef<Path> instead of AsRef<OsStr> in yanix functions (#1950)
* Use AsRef<Path> instead of AsRef<OsStr> in yanix functions.

`AsRef<Path>` makes these more consistent with `std` interfaces, making
them easier to use outside of wasi-common.

Also, refactor the conversion to `CString` into a helper function.

* Reduce clutter from fully-qualifying names.

* rustfmt
2020-07-20 10:02:45 -07:00
Alex Crichton
2f368ed5d6 Fixes needed for 0.19.0 (#2035)
* Add some more wiggle crates to publish

* Fix build of wasi-common on crates.io

* Bump crates to 0.19.1 to fix crates.io build
2020-07-16 17:27:21 -05:00
Alex Crichton
63d5b91930 Wasmtime 0.19.0 and Cranelift 0.66.0 (#2027)
This commit updates Wasmtime's version to 0.19.0, Cranelift's version to
0.66.0, and updates the release notes as well.
2020-07-16 12:46:21 -05:00
Peter Huene
f48f9eb4b3 Merge pull request #2010 from whitequark/fix-windows-creat_trunc
WASI: make O_CREAT|O_TRUNC actually truncate files on Windows
2020-07-11 17:11:22 -07:00
whitequark
92f33284b6 WASI: make O_CREAT|O_TRUNC actually truncate files on Windows
Fixes #2009.
2020-07-10 19:23:37 +00:00
Dan Gohman
cf5289c553 Begin porting yanix to WASI.
This isn't complete yet, but subsequent steps will depend on Rust libstd
and libc bindings changes that are in flight.
2020-07-06 20:20:28 +02:00
Pat Hickey
301277e60d Merge pull request #1961 from bytecodealliance/pch/sync_wasi_pipe
wasi-common virtfs pipe: convert to be Send and Sync; fix Clone
2020-07-01 22:54:25 -07:00
Pat Hickey
e7869c7320 virtfs pipe: implement Clone correctly
* The underlying `R`/`W` doesnt need to be Clone, since we just need to
  clone the Arc it sits behind.
* The rights actually shouldn't be behind an Arc - those get mutated
  separately in each clone.
2020-07-01 17:54:30 -07:00