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
impl Fanotify
sourcepub fn init(flags: InitFlags, event_f_flags: EventFFlags) -> Result<Fanotify>
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).
sourcepub fn mark<Fd: AsFd, P: ?Sized + NixPath>(
&self,
flags: MarkFlags,
mask: MaskFlags,
dirfd: Fd,
path: Option<&P>,
) -> Result<()>
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).
sourcepub fn read_events(&self) -> Result<Vec<FanotifyEvent>>
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.
sourcepub fn write_response(&self, response: FanotifyResponse<'_>) -> Result<()>
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.