]>
git.proxmox.com Git - rustc.git/blob - vendor/rustix/src/mm/madvise.rs
1 //! The `madvise` function.
5 //! `madvise` operates on a raw pointer. Some forms of `madvise` may
6 //! mutate the memory or have other side effects.
9 use crate::{backend, io}
;
10 use core
::ffi
::c_void
;
12 pub use backend
::mm
::types
::Advice
;
14 /// `posix_madvise(addr, len, advice)`—Declares an expected access pattern
15 /// for a memory-mapped file.
19 /// `addr` must be a valid pointer to memory that is appropriate to
20 /// call `posix_madvise` on. Some forms of `advice` may mutate the memory
21 /// or evoke a variety of side-effects on the mapping and/or the file.
25 /// - [Linux `madvise`]
26 /// - [Linux `posix_madvise`]
28 /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_madvise.html
29 /// [Linux `madvise`]: https://man7.org/linux/man-pages/man2/madvise.2.html
30 /// [Linux `posix_madvise`]: https://man7.org/linux/man-pages/man3/posix_madvise.3.html
32 #[doc(alias = "posix_madvise")]
33 pub unsafe fn madvise(addr
: *mut c_void
, len
: usize, advice
: Advice
) -> io
::Result
<()> {
34 backend
::mm
::syscalls
::madvise(addr
, len
, advice
)