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