xref: /third_party/rust/crates/rustix/src/fs/fadvise.rs
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/rust/crates/rustix/src/fs/
1b8a62b91Sopenharmony_ciuse crate::{backend, io};
2b8a62b91Sopenharmony_ciuse backend::fd::AsFd;
3b8a62b91Sopenharmony_ci
4b8a62b91Sopenharmony_cipub use backend::fs::types::Advice;
5b8a62b91Sopenharmony_ci
6b8a62b91Sopenharmony_ci/// `posix_fadvise(fd, offset, len, advice)`—Declares an expected access
7b8a62b91Sopenharmony_ci/// pattern for a file.
8b8a62b91Sopenharmony_ci///
9b8a62b91Sopenharmony_ci/// # References
10b8a62b91Sopenharmony_ci///  - [POSIX]
11b8a62b91Sopenharmony_ci///  - [Linux]
12b8a62b91Sopenharmony_ci///
13b8a62b91Sopenharmony_ci/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fadvise.html
14b8a62b91Sopenharmony_ci/// [Linux]: https://man7.org/linux/man-pages/man2/posix_fadvise.2.html
15b8a62b91Sopenharmony_ci#[inline]
16b8a62b91Sopenharmony_ci#[doc(alias = "posix_fadvise")]
17b8a62b91Sopenharmony_cipub fn fadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64, advice: Advice) -> io::Result<()> {
18b8a62b91Sopenharmony_ci    backend::fs::syscalls::fadvise(fd.as_fd(), offset, len, advice)
19b8a62b91Sopenharmony_ci}
20

Indexes created Thu Nov 07 10:32:03 CST 2024