pub struct NotificationStream { /* private fields */ }Expand description
A stream of seccomp notifications.
This struct provides an asynchronous stream of seccomp notifications.
It wraps an AsyncFd around a SeccompFd to enable asynchronous operations on the seccomp file descriptor.
Implementations§
Source§impl NotificationStream
impl NotificationStream
Sourcepub fn new(fd: RawFd) -> Result<Self, Error>
pub fn new(fd: RawFd) -> Result<Self, Error>
Creates a new NotificationStream from a raw file descriptor.
This method initializes a NotificationStream with the given raw file descriptor.
It sets up the AsyncFd to be ready for reading seccomp notifications.
§Arguments
fd- The raw file descriptor for seccomp notifications.
§Returns
A Result containing a new NotificationStream or an io::Error if the operation fails.
Sourcepub fn blocking_recv(&self) -> Result<Notification, Error>
pub fn blocking_recv(&self) -> Result<Notification, Error>
Receives a seccomp notification.
This method will block until it receives a seccomp notification.
You can prevent it from blocking by listening for self.inner to become readable
using epoll / poll / select.
§Returns
A Result containing a Notification or an io::Error.
Sourcepub async fn recv(&self) -> Result<Notification, Error>
pub async fn recv(&self) -> Result<Notification, Error>
Receives a seccomp notification asynchronously.
This method will not block unless other threads are simultaneously listening for notifications.
§Returns
A Result containing a Notification or an io::Error.
Sourcepub fn send(
&self,
notif: Notification,
response_type: ResponseType,
) -> Result<(), Error>
pub fn send( &self, notif: Notification, response_type: ResponseType, ) -> Result<(), Error>
Sends a response to a seccomp notification.
This method sends a response to a seccomp notification based on the provided ResponseType.
§Arguments
notif- The notification to which the response is being sent.response_type- The type of response to send.
§Returns
A Result indicating the success or failure of the operation.
Sourcepub unsafe fn send_continue(&self, notif: Notification) -> Result<(), Error>
pub unsafe fn send_continue(&self, notif: Notification) -> Result<(), Error>
Sends a continue response to a seccomp notification.
This method sends a continue response to a seccomp notification.
It returns a Result indicating the success or failure of the operation.
§Arguments
notif- The notification to which the continue response is being sent.
§Returns
A Result indicating the success or failure of the operation.
§Safety
This method is unsafe because continuing a syscall is inherently prone to race conditions.
See RawResponse::send_continue for more information.
Trait Implementations§
Source§impl Debug for NotificationStream
impl Debug for NotificationStream
Source§impl Stream for NotificationStream
impl Stream for NotificationStream
Source§fn poll_next(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>>
fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Self::Item>>
Polls the stream for the next notification.
This method polls the stream to check if a new notification is ready to be received.
It returns a Poll indicating whether a notification is ready, an error occurred, or the operation is pending.
§Arguments
self- A mutable reference toself.cx- A context for the current task.
§Returns
A Poll indicating the state of the next notification.
Source§type Item = Notification
type Item = Notification
Auto Trait Implementations§
impl Freeze for NotificationStream
impl !RefUnwindSafe for NotificationStream
impl Send for NotificationStream
impl Sync for NotificationStream
impl Unpin for NotificationStream
impl !UnwindSafe for NotificationStream
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<St> StreamExt for St
impl<St> StreamExt for St
Source§fn next(&mut self) -> Next<'_, Self>where
Self: Unpin,
fn next(&mut self) -> Next<'_, Self>where
Self: Unpin,
None if the
stream is finished. Read moreSource§fn try_next<T, E>(&mut self) -> TryNext<'_, Self>
fn try_next<T, E>(&mut self) -> TryNext<'_, Self>
Source§fn map<T, F>(self, f: F) -> Map<Self, F>
fn map<T, F>(self, f: F) -> Map<Self, F>
Source§fn map_while<T, F>(self, f: F) -> MapWhile<Self, F>
fn map_while<T, F>(self, f: F) -> MapWhile<Self, F>
None. Read moreSource§fn then<F, Fut>(self, f: F) -> Then<Self, Fut, F>
fn then<F, Fut>(self, f: F) -> Then<Self, Fut, F>
Source§fn merge<U>(self, other: U) -> Merge<Self, U>
fn merge<U>(self, other: U) -> Merge<Self, U>
Source§fn filter<F>(self, f: F) -> Filter<Self, F>
fn filter<F>(self, f: F) -> Filter<Self, F>
Source§fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
None. Read moreSource§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n items of the underlying stream. Read moreSource§fn take_while<F>(self, f: F) -> TakeWhile<Self, F>
fn take_while<F>(self, f: F) -> TakeWhile<Self, F>
true. Read moreSource§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n first items of the
underlying stream. Read moreSource§fn skip_while<F>(self, f: F) -> SkipWhile<Self, F>
fn skip_while<F>(self, f: F) -> SkipWhile<Self, F>
true. Read more