Expand description
Filesystem-oriented low-level helpers.
This module contains lightweight Linux and Android file probes and helpers that are useful near the OS boundary, including path existence checks, page-cache read-ahead hints, and symlink-safe read/write primitives.
Structs§
Constants§
Functions§
- ensure_
state_ dir - Create
dirif needed, then verify it is a real directory with no symlink component and that it is owned by the current effective uid. Returning the anchored fd lets callers refuse to operate inside an attacker-pre-created or attacker-redirected state directory. - fadvise
- Advise the kernel on the expected access pattern for a file range.
- mmap_
madvise - Map a file range, advise the kernel that it will be needed, then unmap it.
- open_
append_ nofollow - Open an existing-or-create append stream that refuses to follow symlinks.
- path_
exists - Probe whether a filesystem path is accessible and exists.
- path_
fingerprint - Return a fingerprint of the file metadata at the specified path.
- path_
lstat_ exists - Probe whether a path exists without following symbolic links.
- read_
nofollow - Read a file to a string, refusing to follow a symlink at the final or any parent component.
- read_
to_ string - Read a file into a string.
- readahead
- Advise the kernel to begin reading file data into the page cache.
- remove_
nofollow - Remove a directory entry without following a final symlink, anchored to its (symlink-free) parent. The entry itself is removed even if it is a symlink; its target is never touched.
- write_
atomic - Atomically replace
pathwithcontent.