Commit Graph

24 Commits

Author SHA1 Message Date
Dan Gohman
fa36e86f2c Update WASI to cap-std 0.25 and windows-sys. (#4302)
This updates to rustix 0.35.6, and updates wasi-common to use cap-std 0.25 and
windows-sys (instead of winapi).

Changes include:

 - Better error code mappings on Windows.
 - Fixes undefined references to `utimensat` on Darwin.
 - Fixes undefined references to `preadv64` and `pwritev64` on Android.
 - Updates to io-lifetimes 0.7, which matches the io_safety API in Rust.
 - y2038 bug fixes for 32-bit platforms
2022-06-23 10:47:15 -07:00
Dan Gohman
6a5a295019 Port wasi-common from unsafe-io to io-lifetimes (#3049)
* Port wasi-common to io-lifetimes.

This ports wasi-common from unsafe-io to io-lifetimes.

Ambient authority is now indicated via calls to `ambient_authority()`
from the ambient-authority crate, rather than using `unsafe` blocks.

The `GetSetFdFlags::set_fd_flags` function is now split into two phases,
to simplify lifetimes in implementations which need to close and re-open
the underlying file.

* Use posish for errno values instead of libc.

This eliminates one of the few remaining direct libc dependencies.

* Port to posish::io::poll.

Use posish::io::poll instead of calling libc directly. This factors out
more code from Wasmtime, and eliminates the need to manipulate raw file
descriptors directly.

And, this eliminates the last remaining direct dependency on libc in
wasi-common.

* Port wasi-c-api to io-lifetimes.

* Update to posish 0.16.0.

* Embeded NULs in filenames now get `EINVAL` instead of `EILSEQ`.

* Accept either `EILSEQ` or `EINVAL` for embedded NULs.

* Bump the nightly toolchain to 2021-07-12.

This fixes build errors on the semver crate, which as of this writing
builds with latest nightly and stable but not 2021-04-11, the old pinned
version.

* Have cap-std-sync re-export ambient_authority so that users get the same version.
2021-07-14 15:39:09 -07:00
Alex Crichton
7a1b7cdf92 Implement RFC 11: Redesigning Wasmtime's APIs (#2897)
Implement Wasmtime's new API as designed by RFC 11. This is quite a large commit which has had lots of discussion externally, so for more information it's best to read the RFC thread and the PR thread.
2021-06-03 09:10:53 -05:00
Pat Hickey
f60ae73d15 Merge pull request #2832 from bytecodealliance/pch/wiggle_sync_shimming
wasi-common support for tokio, & wiggle support for async methods containing sync code
2021-05-07 17:43:42 -07:00
Dan Gohman
ec5d8016f7 On Windows, ignore files for which full_metadata fails.
On Windows, `metadata` computes only partial metadata results, which don't
include what WASI needs for the `inode` field in `readdir` results. cap-std
has a `full_metadata` function which is able to include this extra
information, however it has more strict access requirements, so it sometimes
fails even when plain `metadata` would succeed.

Make WASI's `readdir` silently skip over files that can't be accessed by
`full_metadata`. These files wouldn't be openable in any other way by
WASI programs, so the only benefit of listing them would be to
let applications know that they exist. This allows it to avoid failing
and avoid returning bogus results.

This is part of a fix for bytecodealliance/cap-std#169.
2021-05-07 14:47:39 -07:00
Pat Hickey
f3ffd74566 dont depend on wiggle for just the one func 2021-05-06 11:19:25 -07:00
Pat Hickey
f76fe8b764 rewrite wasi-tokio as just an task::block_in_place wrapper on cap-std-sync 2021-05-04 14:15:50 -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
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
Pat Hickey
b29a3bfbb2 fix warnings 2021-02-02 17:08:58 -08:00
Pat Hickey
186360fab2 delete temporary tests 2021-02-02 15:29:50 -08:00
Pat Hickey
a06b23a308 even simpler test case 2021-02-02 13:40:35 -08:00
Pat Hickey
330902f44e add test for incredibly cursed windows rename behavior 2021-02-02 13:29:56 -08:00
Pat Hickey
dec0038ba0 add a readdir unit test to wasi-cap-std-sync 2021-02-01 19:40:24 -08:00
Pat Hickey
f48b45784e remove dead comment 2021-02-01 18:36:49 -08:00
Pat Hickey
cde252c59b wasi-cap-std-sync: sync family of flags is not supported on file_open 2021-02-01 14:25:32 -08:00
Pat Hickey
993697e221 set_fd_flags is only good for append and nonblock 2021-02-01 14:14:13 -08:00
Pat Hickey
a4372c8c2e cap-std-sync: test opening a tempdir as ambient and then WasiDir 2021-02-01 13:15:39 -08:00
Pat Hickey
8b9d2c5bbb cap-std-sync: my set_fd_flags idea didnt seem to work? 2021-02-01 12:42:31 -08:00
Pat Hickey
e9a7a4094c cap-std-sync Dir::open_file: set the fdflags that OpenOptions cant 2021-01-29 21:08:53 -08:00
Pat Hickey
3d406ff50e Dir::open_file can just pass read/write as bools, centralizing FileCaps decoding
this way the impls of File/Dir don't need to know about any caps!
2021-01-29 21:04:34 -08:00
Pat Hickey
9bd89abc0c rename everything c2 related to the "real" names 2021-01-28 15:34:03 -08:00
Pat Hickey
47fec44c10 move wasi-c2 into wasi-common 2021-01-28 15:15:50 -08:00