Commit Graph

350 Commits

Author SHA1 Message Date
Pat Hickey
3df9cddf10 better unit test 2021-05-03 11:59:30 -07:00
Pat Hickey
62c4f0d1f7 wasi-tokio kinda sorta working 2021-05-01 15:39:09 -07:00
Pat Hickey
7f34ccb909 various fixes to the design of Poll 2021-04-30 15:38:18 -07:00
Pat Hickey
b7efcbe80f jump through enough hoops for the poll lifetime to work out
you program rust for a few years and you think you're done tearing your
hair out over lifetimes, well, you'll find yourself wrong
2021-04-29 16:50:22 -07:00
Pat Hickey
b3e1ab4553 restructure Poll to hold a Table and fd instead of a RefMut<dyn WasiFile>
unfortunately, the borrow checker defeated me: changing the
RwSubscription file form a Ref to a RefMut turned into borrow checker
errors in the impl of the poll_oneoff trait method.

This implementation makes an end run by having Poll hold onto the table
and fd, and borrow the file at the site of use, rather than try to own
the RefMut. I have no idea why this convinces the borrow checker that
anything is different, but it does and I need to get this PR done and
I don't think comprimising on this internal abstraction is worth
fighting against
2021-04-28 11:56:48 -07:00
Pat Hickey
a532d0f379 subscribe to mut fds 2021-04-26 16:42:02 -07:00
Pat Hickey
867d2c9a35 follow the types 2021-04-26 15:49:27 -07:00
Pat Hickey
b307dce2ab add readable and writable futures to WasiFile trait 2021-04-26 14:43:16 -07:00
Pat Hickey
fa44ec2da2 tokio sched: comment out just to make it compile 2021-04-26 14:42:22 -07:00
Pat Hickey
3d3a2acc1b wasi-tokio: WIP need to port the sync scheduler into a spawn_blocking 2021-04-19 16:00:38 -07:00
Pat Hickey
675b579361 use AsyncSeek 2021-04-19 14:35:46 -07:00
Pat Hickey
d2a98ced53 use some better traits 2021-04-15 16:00:11 -07:00
Pat Hickey
9880d09f1f do some programming 2021-04-15 14:50:17 -07:00
Pat Hickey
33dbd4388c use tokio's File with a cap-std Dir 2021-04-15 11:39:11 -07:00
Pat Hickey
7202494e9d fix windows sched 2021-04-14 16:17:21 -07:00
Pat Hickey
c0e89b8da8 wasi-cap-std-sync: WasiFile and WasiDir converted to async_traits 2021-04-14 15:43:19 -07:00
Pat Hickey
564e43d1b3 WasiDir: make all operations async 2021-04-14 15:22:25 -07:00
Pat Hickey
00e58567d9 WasiFile: all operations are now async
only fn as_any(&self) -> &dyn Any doesnt get to be async.
2021-04-14 15:17:31 -07:00
Pat Hickey
025a1ecff4 wasi-common: snapshots 0 and 1 traits are all async now 2021-04-14 15:05:38 -07:00
Pat Hickey
0127676621 wasi-cap-std-async is better named wasi-tokio 2021-04-14 14:06:36 -07:00
Pat Hickey
ac3b456523 wasi-cap-std-async: exactly like wasi-cap-std-sync but with a different WasiSched 2021-04-13 17:51:18 -07:00
Pat Hickey
22d18ffb0d cap-std-sync: async-trait e-paperwork 2021-04-13 17:51:18 -07:00
Pat Hickey
68daec7e7d wasi-common: WasiSched is an async trait now; poll_oneoff and sched_yield are async methods 2021-04-13 17:51:18 -07:00
Chris Fallin
6bec13da04 Bump versions: Wasmtime to 0.26.0, Cranelift to 0.73.0. 2021-04-05 10:48:42 -07:00
Pat Hickey
07245a8763 wasi-cap-std-sync: re-export Dir while we're at it 2021-03-25 17:05:02 -07:00
Pat Hickey
1d663bfd71 delete straggler InDataField 2021-03-24 11:19:12 -07:00
Pat Hickey
e6c7e00a52 wiggle-using crates: delete GuestErrorConversion 2021-03-24 10:39:06 -07:00
Pat Hickey
81dfb9c458 wasi: make WasiSched::sleep fallible
some systems do not support sleeping and may want to return EINVAL here.
2021-03-23 10:20:03 -07:00
Dan Gohman
2880dab8f8 Add a sleep function to the WasiSched trait. 2021-03-22 12:50:16 -07:00
Dan Gohman
6b40724d18 Support "sleep" forms of poll_oneoff.
Add support for `poll_oneoff` calls which just sleep on a relative
timeout. This fixes a bug handling code compiled with WASI libc's `sleep`
family of functions, which call `poll_oneoff` with a `CLOCK_REALTIME`
timer, which wasn't previously implemented.
2021-03-22 12:50:16 -07:00
Dan Gohman
cba0144612 Use min_by instead of sort_by when we only want the minimum element.
This is just a minor code simplification I happened to notice while
doing unrelated work on `poll_oneoff`.
2021-03-22 11:08:28 -07:00
Nick Fitzgerald
d081ef9c2e Bump Wasmtime to 0.25.0; Cranelift to 0.72.0 2021-03-16 11:02:56 -07:00
Christopher Serr
cc84c693a3 wasi-common: Timestamps should be in nanoseconds (#2717)
Sleeping takes 1000x longer than it should because the timestamps are
interpreted as microseconds by accident.
2021-03-10 09:09:34 -06:00
Pat Hickey
ccdf6ec0b1 Merge pull request #2701 from bytecodealliance/pch/wiggle_async
wiggle: support for Rust async
2021-03-05 10:43:55 -08:00
Dan Gohman
8854dec01d Bump version to 0.24.0
I used a specially modified version of the publish script to avoid
bumping the `witx` version.
2021-03-04 18:17:03 -08:00
Pat Hickey
bcebdd43ef wiggle use sites: remove ctx argument 2021-03-04 18:16:37 -08:00
Johnnie Birch
2190fb68fd Update version for fs-set-times to 3.1 2021-03-04 11:36:31 -08:00
Dan Gohman
0824a934bf Add a minimal README.md for cap-std-sync. 2021-03-01 09:58:57 -08:00
Alex Crichton
d095f63cfd Update submodules 2021-02-18 14:45:20 -08:00
Alex Crichton
26e9ea433e Fix a bug in wasi 2021-02-18 14:45:20 -08:00
Alex Crichton
fa98f0bc91 Fix wiggle tests 2021-02-18 14:45:20 -08:00
Alex Crichton
df9c725fa0 Update to the next version of the witx crate
This commit updates to the 0.9 version of the witx crate implemented in
WebAssembly/wasi#395. This new version drastically changes code
generation and how we interface with the crate. The intention is to
abstract the code generation aspects and allow code generators to
implement much more low-level instructions to enable more flexible APIs
in the future. Additionally a bunch of `*.witx` files were updated in
the WASI repository.

It's worth pointing out, however, that `wasi-common` does not change as
a result of this change. The shape of the APIs that we need to implement
are effectively the same and the only difference is that the shim
functions generated by wiggle are a bit different.
2021-02-18 14:45:20 -08:00
Dan Gohman
8d90ea0390 Bump version to 0.23.0
I used a specially modified version of the publish script to avoid
bumping the `witx` version.
2021-02-17 15:35:43 -08:00
Pat Hickey
c9d8ed03c9 wasi-common: fix fdstat of dirfd
the fdstat of a dirfd needs to include both the file and dir rights in
the inheriting field.

The wasi-libc path_open bases the base rights of child directories off
the inheriting rights of the parent, so if we only put file rights in
there, opening a child directory will not have any directory operations
permitted.

Fixes https://github.com/bytecodealliance/wasmtime/issues/2638
2021-02-10 16:53:39 -08:00
Pat Hickey
e4ce04bab4 WasiCtx: default to empty/sink stdio files rather than throw
the test harness now uses the empty stdin file. I tested manually that
the sink stdout & stderr files work, but theres no test in tree at the
moment
2021-02-05 17:50:20 -08:00
Pat Hickey
c535b94c73 theres the bug 2021-02-04 15:38:02 -08:00
Pat Hickey
4681e18ee0 will this fix it? 2021-02-04 14:58:44 -08:00
Pat Hickey
5ff9578b5c wasi-common: WASI/phases is included in the package 2021-02-04 10:37:45 -08:00
Pat Hickey
e2b67aa9a3 simplify life for readdir implementors 2021-02-03 18:04:26 -08:00
Pat Hickey
c8ca639b93 new cap-std apis fix some windows tests!
fix for fd_readdir test on linux, and symlink_create / nofollow_errors
2021-02-03 16:16:23 -08:00