fanotify_event_metadata in naughtyfy::types - Rust
Description: After a successful read(2), the read buffer contains the following structure
Keywords: rust, rustlang, rust-lang, fanotify_event_metadata

# Struct naughtyfy::types::fanotify_event_metadata

source ·

    #[repr(C)]pub struct fanotify_event_metadata {
        pub event_len: __u32,
        pub vers: __u8,
        pub reserved: __u8,
        pub metadata_len: __u16,
        pub mask: __u64,
        pub fd: __s32,
        pub pid: __s32,
    }

Expand description

After a successful read(2), the read buffer contains the following structure

## Fields§

§`event_len: __u32`

This is the length of the data for the current event and the offset to the next event in the buffer. Unless the group identifies filesystem objects by file handles, the value of event_len is always `FAN_EVENT_METADATA_LEN`. For a group that identifies filesystem objects by file handles, event_len also includes the variable length file identifier records.

§`vers: __u8`

This field holds a version number for the structure. It must be compared to `FANOTIFY_METADATA_VERSION` to verify that the structures returned at run time match the structures defined at compile time. In case of a mismatch, the application should abandon trying to use the fanotify file descriptor.

§`reserved: __u8`

This field is not used.

§`metadata_len: __u16`

This is the length of the structure. The field was introduced to facilitate the implementation of optional headers per event type. No such optional headers exist in the current implementation.

§`mask: __u64`

This is a bit mask describing the event (see below).

§`fd: __s32`

This is an open file descriptor for the object being accessed,or FAN_NOFD if a queue overflow occurred.
If the fanotify file descriptor has been initialized using FAN_REPORT_FID, applications should expect this value to be set to FAN_NOFD for each event that is received. The file descriptor can be used to access the contents of the monitored file or directory. The reading application is responsible for closing this file descriptor. When calling fanotify_init(2), the caller may specify (via the event_f_flags argument) various file status flags that are to be set on the open file description that corresponds to this file descriptor. In addition, the (kernel-internal) FMODE_NONOTIFY file status flag is set on the open file description.
This flag suppresses fanotify event generation. Hence, when the receiver of the fanotify event accesses the notified file or directory using this file descriptor, noadditional events will be created.

§`pid: __s32`

If flag `FAN_REPORT_TID` was set in fanotify_init(2), this is the TID of the thread that caused the event. Otherwise, this the PID of the process that caused the event.

## Trait Implementations§

source§

### impl Clone for fanotify_event_metadata

source§

#### fn clone(&self) -> fanotify_event_metadata

Returns a copy of the value. Read more
1.0.0 · source§

#### fn clone_from(&mut self, source: &Self)

Performs copy-assignment from `source`. Read more
source§

### impl Debug for fanotify_event_metadata

source§

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

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

### impl Copy for fanotify_event_metadata

## Auto Trait Implementations§

§

### impl RefUnwindSafe for fanotify_event_metadata

§

### impl Send for fanotify_event_metadata

§

### impl Sync for fanotify_event_metadata

§

### impl Unpin for fanotify_event_metadata

§

### impl UnwindSafe for fanotify_event_metadata

## Blanket Implementations§

source§

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

source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
source§

### impl<T> Borrow<T> for Twhere
T: ?Sized,

const: unstable · source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

### impl<T> BorrowMut<T> for Twhere
T: ?Sized,

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

### impl<T> From<T> for T

const: unstable · source§

#### fn from(t: T) -> T

Returns the argument unchanged.

source§

### impl<T, U> Into<U> for Twhere
U: From<T>,

const: unstable · 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> ToOwned for Twhere
T: Clone,

§

#### type Owned = T

The resulting type after obtaining ownership.
source§

#### fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

#### fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

### impl<T, U> TryFrom<U> for Twhere
U: Into<T>,

§

#### type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

### impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.