()
| 169 | #[cfg(any(target_os = "emscripten", target_os = "linux"))] |
| 170 | #[test] |
| 171 | fn test_mremap() { |
| 172 | use rustix::mm::{mmap_anonymous, mremap, munmap, MapFlags, MremapFlags, ProtFlags}; |
| 173 | use std::ptr::null_mut; |
| 174 | |
| 175 | unsafe { |
| 176 | let addr = mmap_anonymous(null_mut(), 8192, ProtFlags::READ, MapFlags::PRIVATE).unwrap(); |
| 177 | |
| 178 | assert_eq!( |
| 179 | mremap(addr, 4096, 16384, MremapFlags::empty()), |
| 180 | Err(rustix::io::Errno::NOMEM) |
| 181 | ); |
| 182 | let new = mremap(addr, 4096, 16384, MremapFlags::MAYMOVE).unwrap(); |
| 183 | assert_ne!(new, addr); |
| 184 | assert!(!new.is_null()); |
| 185 | |
| 186 | munmap(new, 16384).unwrap(); |
| 187 | munmap(addr.offset(4096), 4096).unwrap(); |
| 188 | } |
| 189 | } |
nothing calls this directly
no test coverage detected