Struct nix::sys::fanotify::Fanotify

source ·
pub struct Fanotify { /* private fields */ }
Expand description

A fanotify group. This is also a file descriptor that can feed to other interfaces consuming file descriptors.

Implementations§

source§

impl Fanotify

source

pub fn init(flags: InitFlags, event_f_flags: EventFFlags) -> Result<Fanotify>

Initialize a new fanotify group.

Returns a Result containing a Fanotify instance.

For more information, see fanotify_init(2).

source

pub fn mark<Fd: AsFd, P: ?Sized + NixPath>( &self, flags: MarkFlags, mask: MaskFlags, dirfd: Fd, path: Option<&P>, ) -> Result<()>

Add, remove, or modify an fanotify mark on a filesystem object.

Returns a Result containing either () on success or errno otherwise.

For more information, see fanotify_mark(2).

source

pub fn read_events(&self) -> Result<Vec<FanotifyEvent>>

Read incoming events from the fanotify group.

Returns a Result containing either a Vec of events on success or errno otherwise.

§Errors

Possible errors can be those that are explicitly listed in fanotify(2) in addition to the possible errors caused by read call. In particular, EAGAIN is returned when no event is available on a group that has been initialized with the flag InitFlags::FAN_NONBLOCK, thus making this method nonblocking.

source

pub fn write_response(&self, response: FanotifyResponse<'_>) -> Result<()>

Write an event response on the fanotify group.

Returns a Result containing either () on success or errno otherwise.

§Errors

Possible errors can be those that are explicitly listed in fanotify(2) in addition to the possible errors caused by write call. In particular, EAGAIN or EWOULDBLOCK is returned when no event is available on a group that has been initialized with the flag InitFlags::FAN_NONBLOCK, thus making this method nonblocking.

Trait Implementations§

source§

impl AsFd for Fanotify

source§

fn as_fd(&self) -> BorrowedFd<'_>

Borrows the file descriptor. Read more
source§

impl Debug for Fanotify

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromRawFd for Fanotify

source§

unsafe fn from_raw_fd(fd: RawFd) -> Self

Constructs a new instance of Self from the given raw file descriptor. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.