| 1 |
use crate::{backend, io}; |
| 2 |
use backend::fd::AsFd; |
| 3 |
|
| 4 |
/// `fcntl(fd, F_RDADVISE, radvisory { offset, len })` |
| 5 |
/// |
| 6 |
/// # References |
| 7 |
/// - [Apple] |
| 8 |
/// |
| 9 |
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html |
| 10 |
#[doc(alias = "F_RDADVISE")] |
| 11 |
#[inline] |
| 12 |
pub fn fcntl_rdadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64) -> io::Result<()> { |
| 13 |
backend::fs::syscalls::fcntl_rdadvise(fd.as_fd(), offset, len) |
| 14 |
} |
| 15 |
|
| 16 |
/// `fcntl(fd, F_FULLFSYNC)` |
| 17 |
/// |
| 18 |
/// # References |
| 19 |
/// - [Apple] |
| 20 |
/// |
| 21 |
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html |
| 22 |
#[doc(alias = "F_FULLSYNC")] |
| 23 |
#[inline] |
| 24 |
pub fn fcntl_fullfsync<Fd: AsFd>(fd: Fd) -> io::Result<()> { |
| 25 |
backend::fs::syscalls::fcntl_fullfsync(fd.as_fd()) |
| 26 |
} |
| 27 |
|
| 28 |
/// `fcntl(fd, F_NOCACHE, value)`—Turn data caching off or on for a file |
| 29 |
/// descriptor. |
| 30 |
/// |
| 31 |
/// See [this mailing list post] for additional information about the meanings |
| 32 |
/// of `F_NOCACHE` and `F_GLOBAL_NOCACHE`. |
| 33 |
/// |
| 34 |
/// [this mailing list post]: https://lists.apple.com/archives/filesystem-dev/2007/Sep/msg00010.html |
| 35 |
/// |
| 36 |
/// See also [`fcntl_global_nocache`]. |
| 37 |
/// |
| 38 |
/// # References |
| 39 |
/// - [Apple] |
| 40 |
/// |
| 41 |
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html |
| 42 |
#[doc(alias = "F_NOCACHE")] |
| 43 |
#[inline] |
| 44 |
pub fn fcntl_nocache<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> { |
| 45 |
backend::fs::syscalls::fcntl_nocache(fd.as_fd(), value) |
| 46 |
} |
| 47 |
|
| 48 |
/// `fcntl(fd, F_GLOBAL_NOCACHE, value)`—Turn data caching off or on for all |
| 49 |
/// file descriptors. |
| 50 |
/// |
| 51 |
/// See [this mailing list post] for additional information about the meanings |
| 52 |
/// of `F_NOCACHE` and `F_GLOBAL_NOCACHE`. |
| 53 |
/// |
| 54 |
/// [this mailing list post]: https://lists.apple.com/archives/filesystem-dev/2007/Sep/msg00010.html |
| 55 |
/// |
| 56 |
/// See also [`fcntl_nocache`]. |
| 57 |
/// |
| 58 |
/// # References |
| 59 |
/// - [Apple] |
| 60 |
/// |
| 61 |
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html |
| 62 |
#[doc(alias = "F_GLOBAL_NOCACHE")] |
| 63 |
#[inline] |
| 64 |
pub fn fcntl_global_nocache<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> { |
| 65 |
backend::fs::syscalls::fcntl_global_nocache(fd.as_fd(), value) |
| 66 |
} |