Skip to main content

Module fid_parser

Module fid_parser 

Source

Structs§

FanFd
Newtype wrapper around a raw fanotify file descriptor. Implements AsRawFd and AsFd so it can be used with AsyncFd.
FsGroup
A group of fds for a single filesystem. One fanotify fd + one directory fd per filesystem, shared by all paths on it.

Constants§

DEFAULT_EVENT_MASK
Default mask: 8 core events (FS_ERROR excluded — only works with FS marks). Use –types all to get all 14 (FS_ERROR included, but only effective on FS marks).
DIR_CACHE_CAP
Capacity for the moka directory handle cache (path→handle key reverse lookup). 100k covers ~10s of thousands of directories with room to spare. moka uses W-TinyLFU eviction when this limit is reached.
DIR_CACHE_TTL_SECS
TTL for directory handle cache entries. After 1 hour of no access, entries are automatically evicted. This prevents stale entries when directories are deleted/renamed.
FILE_SIZE_CACHE_CAP

Functions§

chown_to_user
Chown a file or directory to the original user (daemon runs as root). Resolves the original user from SUDO_UID/SUDO_GID env vars.
event_type_to_kernel_flag
Convert an EventType to its fanotify kernel flag.
mark_directory
Mark a single directory. Strips FAN_FS_ERROR (only works with FS marks).
mark_recursive
Recursively traverse and mark all subdirectories (ignore errors, e.g., permission denied). Strips FAN_FS_ERROR (only works with FS marks).
mask_to_event_types
Convert a fanotify event mask to fsmon’s EventType enum.
path_mask_from_options
Build kernel mask from PathOptions: explicit types or default.
read_fid_events_cached
Read and parse FID events, using a moka cache for path recovery.