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 | pub fn fadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64, advice: Advice) -> io::Result<()> { |
18 | backend::fs::syscalls::fadvise(fd.as_fd(), pos:offset, len, advice) |
19 | } |
20 | |