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
This commit is contained in:
Dan Gohman
2022-06-23 10:47:15 -07:00
committed by GitHub
parent 445cc87a06
commit fa36e86f2c
27 changed files with 317 additions and 186 deletions

View File

@@ -47,7 +47,7 @@ impl FiberStack {
pub fn new(size: usize) -> io::Result<Self> {
// Round up our stack size request to the nearest multiple of the
// page size.
let page_size = rustix::process::page_size();
let page_size = rustix::param::page_size();
let size = if size == 0 {
page_size
} else {
@@ -57,17 +57,17 @@ impl FiberStack {
unsafe {
// Add in one page for a guard page and then ask for some memory.
let mmap_len = size + page_size;
let mmap = rustix::io::mmap_anonymous(
let mmap = rustix::mm::mmap_anonymous(
ptr::null_mut(),
mmap_len,
rustix::io::ProtFlags::empty(),
rustix::io::MapFlags::PRIVATE,
rustix::mm::ProtFlags::empty(),
rustix::mm::MapFlags::PRIVATE,
)?;
rustix::io::mprotect(
rustix::mm::mprotect(
mmap.cast::<u8>().add(page_size).cast(),
size,
rustix::io::MprotectFlags::READ | rustix::io::MprotectFlags::WRITE,
rustix::mm::MprotectFlags::READ | rustix::mm::MprotectFlags::WRITE,
)?;
Ok(Self {
@@ -90,7 +90,7 @@ impl Drop for FiberStack {
fn drop(&mut self) {
unsafe {
if let Some(len) = self.len {
let ret = rustix::io::munmap(self.top.sub(len) as _, len);
let ret = rustix::mm::munmap(self.top.sub(len) as _, len);
debug_assert!(ret.is_ok());
}
}