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

@@ -64,11 +64,11 @@ impl Mmap {
.len();
let len = usize::try_from(len).map_err(|_| anyhow!("file too large to map"))?;
let ptr = unsafe {
rustix::io::mmap(
rustix::mm::mmap(
ptr::null_mut(),
len,
rustix::io::ProtFlags::READ,
rustix::io::MapFlags::PRIVATE,
rustix::mm::ProtFlags::READ,
rustix::mm::MapFlags::PRIVATE,
&file,
0,
)
@@ -171,11 +171,11 @@ impl Mmap {
Ok(if accessible_size == mapping_size {
// Allocate a single read-write region at once.
let ptr = unsafe {
rustix::io::mmap_anonymous(
rustix::mm::mmap_anonymous(
ptr::null_mut(),
mapping_size,
rustix::io::ProtFlags::READ | rustix::io::ProtFlags::WRITE,
rustix::io::MapFlags::PRIVATE,
rustix::mm::ProtFlags::READ | rustix::mm::ProtFlags::WRITE,
rustix::mm::MapFlags::PRIVATE,
)
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
};
@@ -188,11 +188,11 @@ impl Mmap {
} else {
// Reserve the mapping size.
let ptr = unsafe {
rustix::io::mmap_anonymous(
rustix::mm::mmap_anonymous(
ptr::null_mut(),
mapping_size,
rustix::io::ProtFlags::empty(),
rustix::io::MapFlags::PRIVATE,
rustix::mm::ProtFlags::empty(),
rustix::mm::MapFlags::PRIVATE,
)
.context(format!("mmap failed to allocate {:#x} bytes", mapping_size))?
};
@@ -430,7 +430,7 @@ impl Drop for Mmap {
#[cfg(not(target_os = "windows"))]
fn drop(&mut self) {
if self.len != 0 {
unsafe { rustix::io::munmap(self.ptr as *mut std::ffi::c_void, self.len) }
unsafe { rustix::mm::munmap(self.ptr as *mut std::ffi::c_void, self.len) }
.expect("munmap failed");
}
}