1//! The `msync` function. 2//! 3//! # Safety 4//! 5//! `msync` operates on a raw pointer. Some forms of `msync` may mutate the 6//! memory or have other side effects. 7#![allow(unsafe_code)] 8 9use crate::{backend, io}; 10use core::ffi::c_void; 11 12pub use backend::mm::types::MsyncFlags; 13 14/// `msync(addr, len, flags)`—Synchronizes a memory-mapping with its backing 15/// storage. 16/// 17/// # Safety 18/// 19/// `addr` must be a valid pointer to memory that is appropriate to 20/// call `msync` on. Some forms of `msync` may mutate the memory 21/// or evoke a variety of side-effects on the mapping and/or the file. 22/// 23/// # References 24/// - [POSIX] 25/// - [Linux `msync`] 26/// 27/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/msync.html 28/// [Linux `msync`]: https://man7.org/linux/man-pages/man2/msync.2.html 29#[inline] 30pub unsafe fn msync(addr: *mut c_void, len: usize, flags: MsyncFlags) -> io::Result<()> { 31 backend::mm::syscalls::msync(addr, len, flags) 32} 33