()
| 29 | #[cfg(linux_kernel)] |
| 30 | #[test] |
| 31 | fn test_mlock_with() { |
| 32 | let mut buf = vec![0_u8; 4096]; |
| 33 | |
| 34 | unsafe { |
| 35 | match rustix::mm::mlock_with( |
| 36 | buf.as_mut_ptr().cast::<c_void>(), |
| 37 | buf.len(), |
| 38 | rustix::mm::MlockFlags::empty(), |
| 39 | ) { |
| 40 | Ok(()) => rustix::mm::munlock(buf.as_mut_ptr().cast::<c_void>(), buf.len()).unwrap(), |
| 41 | // Tests won't always have enough memory or permissions, and that's ok. |
| 42 | Err(rustix::io::Errno::PERM | rustix::io::Errno::NOMEM | rustix::io::Errno::NOSYS) => {} |
| 43 | // But they shouldn't fail otherwise. |
| 44 | Err(other) => panic!("{:?}", other), |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | #[cfg(linux_kernel)] |
| 50 | #[test] |
nothing calls this directly
no test coverage detected