Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maps/ringbuf: make RingBuf: Send + Sync #843

Merged
merged 1 commit into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions aya/src/maps/ring_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ struct MMap {
len: usize,
}

// Needed because NonNull<T> is !Send and !Sync out of caution that the data
// might be aliased unsafely.
unsafe impl Send for MMap {}
unsafe impl Sync for MMap {}

impl MMap {
fn new(
fd: BorrowedFd<'_>,
Expand Down
12 changes: 6 additions & 6 deletions xtask/public-api/aya.txt
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,8 @@ pub type aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData>::Error = aya::
pub fn aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result<Self, Self::Error>
impl<T: core::borrow::Borrow<aya::maps::MapData>> std::os::fd::raw::AsRawFd for aya::maps::ring_buf::RingBuf<T>
pub fn aya::maps::ring_buf::RingBuf<T>::as_raw_fd(&self) -> std::os::fd::raw::RawFd
impl<T> !core::marker::Send for aya::maps::ring_buf::RingBuf<T>
impl<T> !core::marker::Sync for aya::maps::ring_buf::RingBuf<T>
impl<T> core::marker::Send for aya::maps::ring_buf::RingBuf<T> where T: core::marker::Send
impl<T> core::marker::Sync for aya::maps::ring_buf::RingBuf<T> where T: core::marker::Sync
impl<T> core::marker::Unpin for aya::maps::ring_buf::RingBuf<T> where T: core::marker::Unpin
impl<T> core::panic::unwind_safe::RefUnwindSafe for aya::maps::ring_buf::RingBuf<T> where T: core::panic::unwind_safe::RefUnwindSafe
impl<T> core::panic::unwind_safe::UnwindSafe for aya::maps::ring_buf::RingBuf<T> where T: core::panic::unwind_safe::UnwindSafe
Expand Down Expand Up @@ -618,8 +618,8 @@ pub type aya::maps::ring_buf::RingBufItem<'_>::Target = [u8]
pub fn aya::maps::ring_buf::RingBufItem<'_>::deref(&self) -> &Self::Target
impl core::ops::drop::Drop for aya::maps::ring_buf::RingBufItem<'_>
pub fn aya::maps::ring_buf::RingBufItem<'_>::drop(&mut self)
impl<'a> !core::marker::Send for aya::maps::ring_buf::RingBufItem<'a>
impl<'a> !core::marker::Sync for aya::maps::ring_buf::RingBufItem<'a>
impl<'a> core::marker::Send for aya::maps::ring_buf::RingBufItem<'a>
impl<'a> core::marker::Sync for aya::maps::ring_buf::RingBufItem<'a>
impl<'a> core::marker::Unpin for aya::maps::ring_buf::RingBufItem<'a>
impl<'a> core::panic::unwind_safe::RefUnwindSafe for aya::maps::ring_buf::RingBufItem<'a>
impl<'a> !core::panic::unwind_safe::UnwindSafe for aya::maps::ring_buf::RingBufItem<'a>
Expand Down Expand Up @@ -2077,8 +2077,8 @@ pub type aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData>::Error = aya::
pub fn aya::maps::ring_buf::RingBuf<&'a mut aya::maps::MapData>::try_from(map: &'a mut aya::maps::Map) -> core::result::Result<Self, Self::Error>
impl<T: core::borrow::Borrow<aya::maps::MapData>> std::os::fd::raw::AsRawFd for aya::maps::ring_buf::RingBuf<T>
pub fn aya::maps::ring_buf::RingBuf<T>::as_raw_fd(&self) -> std::os::fd::raw::RawFd
impl<T> !core::marker::Send for aya::maps::ring_buf::RingBuf<T>
impl<T> !core::marker::Sync for aya::maps::ring_buf::RingBuf<T>
impl<T> core::marker::Send for aya::maps::ring_buf::RingBuf<T> where T: core::marker::Send
impl<T> core::marker::Sync for aya::maps::ring_buf::RingBuf<T> where T: core::marker::Sync
impl<T> core::marker::Unpin for aya::maps::ring_buf::RingBuf<T> where T: core::marker::Unpin
impl<T> core::panic::unwind_safe::RefUnwindSafe for aya::maps::ring_buf::RingBuf<T> where T: core::panic::unwind_safe::RefUnwindSafe
impl<T> core::panic::unwind_safe::UnwindSafe for aya::maps::ring_buf::RingBuf<T> where T: core::panic::unwind_safe::UnwindSafe
Expand Down