From c89b2d156dbddd495f885edecbf71910cc61bba8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:00:25 +0000 Subject: [PATCH] build(deps): update async-io requirement from 1.3 to 2.0 Updates the requirements on [async-io](https://github.com/smol-rs/async-io) to permit the latest version. - [Release notes](https://github.com/smol-rs/async-io/releases) - [Changelog](https://github.com/smol-rs/async-io/blob/master/CHANGELOG.md) - [Commits](https://github.com/smol-rs/async-io/compare/v1.3.0...v1.13.0) --- updated-dependencies: - dependency-name: async-io dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- Cargo.toml | 2 +- aya/src/maps/perf/async_perf_event_array.rs | 2 +- aya/src/maps/perf/perf_event_array.rs | 8 +++++++- xtask/public-api/aya.txt | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) 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