diff --git a/Cargo.toml b/Cargo.toml index 3ce5005f..70684050 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ default-members = [ [workspace.dependencies] anyhow = { version = "1", default-features = false } assert_matches = { version = "1.5.0", default-features = false } -async-io = { version = "1.3", default-features = false } +async-io = { version = "2.0", default-features = false } aya = { path = "aya", version = "0.11.0", default-features = false } aya-bpf = { path = "bpf/aya-bpf", default-features = false } aya-log = { path = "aya-log", default-features = false } diff --git a/aya/src/maps/perf/async_perf_event_array.rs b/aya/src/maps/perf/async_perf_event_array.rs index 4b7d097e..7828759a 100644 --- a/aya/src/maps/perf/async_perf_event_array.rs +++ b/aya/src/maps/perf/async_perf_event_array.rs @@ -159,7 +159,7 @@ impl> AsyncPerfEventArrayBuffer { if !buf.get_ref().readable() { buf.readable().await?; } - buf.get_mut() + unsafe { buf.get_mut() } }; let events = buf.read_events(buffers)?; diff --git a/aya/src/maps/perf/perf_event_array.rs b/aya/src/maps/perf/perf_event_array.rs index ebeef672..c1df535a 100644 --- a/aya/src/maps/perf/perf_event_array.rs +++ b/aya/src/maps/perf/perf_event_array.rs @@ -4,7 +4,7 @@ use std::{ borrow::{Borrow, BorrowMut}, ops::Deref, - os::fd::{AsFd as _, AsRawFd, RawFd}, + os::fd::{AsFd, AsRawFd, BorrowedFd, RawFd}, sync::Arc, }; @@ -55,6 +55,12 @@ impl> PerfEventArrayBuffer { } } +impl> AsFd for PerfEventArrayBuffer { + fn as_fd(&self) -> BorrowedFd<'_> { + self.buf.as_fd() + } +} + impl> AsRawFd for PerfEventArrayBuffer { fn as_raw_fd(&self) -> RawFd { self.buf.as_raw_fd() diff --git a/xtask/public-api/aya.txt b/xtask/public-api/aya.txt index b2b28876..591ebaf4 100644 --- a/xtask/public-api/aya.txt +++ b/xtask/public-api/aya.txt @@ -510,6 +510,8 @@ pub struct aya::maps::perf::PerfEventArrayBuffer impl> aya::maps::perf::PerfEventArrayBuffer pub fn aya::maps::perf::PerfEventArrayBuffer::read_events(&mut self, out_bufs: &mut [bytes::bytes_mut::BytesMut]) -> core::result::Result pub fn aya::maps::perf::PerfEventArrayBuffer::readable(&self) -> bool +impl> std::os::fd::owned::AsFd for aya::maps::perf::PerfEventArrayBuffer +pub fn aya::maps::perf::PerfEventArrayBuffer::as_fd(&self) -> std::os::fd::owned::BorrowedFd<'_> impl> std::os::fd::raw::AsRawFd for aya::maps::perf::PerfEventArrayBuffer pub fn aya::maps::perf::PerfEventArrayBuffer::as_raw_fd(&self) -> std::os::fd::raw::RawFd impl core::marker::Send for aya::maps::perf::PerfEventArrayBuffer where T: core::marker::Send + core::marker::Sync