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