Update to rustix 0.26.2. (#3521)

This pulls in a fix for Android, where Android's seccomp policy on older
versions is to make `openat2` irrecoverably crash the process, so we have
to do a version check up front rather than relying on `ENOSYS` to
determine if `openat2` is supported.

And it pulls in the fix for the link errors when multiple versions of
rsix/rustix are linked in.

And it has updates for two crate renamings: rsix has been renamed to
rustix, and unsafe-io has been renamed to io-extras.
This commit is contained in:
Dan Gohman
2021-11-15 10:21:13 -08:00
committed by GitHub
parent 81f6228c57
commit ea0cb971fb
25 changed files with 136 additions and 137 deletions

View File

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