Coverage Report

Created: 2025-10-10 06:06

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/rustix-1.1.2/src/fs/fadvise.rs
Line
Count
Source
1
use crate::{backend, io};
2
use backend::fd::AsFd;
3
use backend::fs::types::Advice;
4
use core::num::NonZeroU64;
5
6
/// `posix_fadvise(fd, offset, len, advice)`—Declares an expected access
7
/// pattern for a file.
8
///
9
/// If `len` is `None`, the advice extends to the end of the file.
10
///
11
/// # References
12
///  - [POSIX]
13
///  - [Linux]
14
///  - [FreeBSD]
15
///
16
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_fadvise.html
17
/// [Linux]: https://man7.org/linux/man-pages/man2/posix_fadvise.2.html
18
/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=posix_fadvise&sektion=2
19
#[inline]
20
#[doc(alias = "posix_fadvise")]
21
0
pub fn fadvise<Fd: AsFd>(
22
0
    fd: Fd,
23
0
    offset: u64,
24
0
    len: Option<NonZeroU64>,
25
0
    advice: Advice,
26
0
) -> io::Result<()> {
27
0
    backend::fs::syscalls::fadvise(fd.as_fd(), offset, len, advice)
28
0
}