Coverage Report

Created: 2023-04-25 07:07

/rust/registry/src/index.crates.io-6f17d22bba15001f/rustix-0.37.13/src/fs/fadvise.rs
Line
Count
Source (jump to first uncovered line)
1
use crate::{backend, io};
2
use backend::fd::AsFd;
3
4
pub use backend::fs::types::Advice;
5
6
/// `posix_fadvise(fd, offset, len, advice)`—Declares an expected access
7
/// pattern for a file.
8
///
9
/// # References
10
///  - [POSIX]
11
///  - [Linux]
12
///
13
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fadvise.html
14
/// [Linux]: https://man7.org/linux/man-pages/man2/posix_fadvise.2.html
15
#[inline]
16
#[doc(alias = "posix_fadvise")]
17
0
pub fn fadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64, advice: Advice) -> io::Result<()> {
18
0
    backend::fs::syscalls::fadvise(fd.as_fd(), offset, len, advice)
19
0
}