From 0099bd97babb4933cfb5cda2ce9904a19788115e Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 12 Nov 2023 16:48:21 +0000 Subject: [PATCH] feat: munlock `NonNull` --- changelog/2000.changed.md | 2 +- src/sys/mman.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog/2000.changed.md b/changelog/2000.changed.md index e6b105417d..602432b850 100644 --- a/changelog/2000.changed.md +++ b/changelog/2000.changed.md @@ -1 +1 @@ -`mmap`, `mmap_anonymous`, `munmap`, `mremap`, `madvise`, `msync` and `mprotect` updated to use `NonNull`. \ No newline at end of file +`mmap`, `mmap_anonymous`, `munmap`, `mremap`, `madvise`, `msync`, `mprotect` and `munlock` updated to use `NonNull`. \ No newline at end of file diff --git a/src/sys/mman.rs b/src/sys/mman.rs index 5e4acba97a..70b092441e 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -388,8 +388,8 @@ pub unsafe fn mlock(addr: *const c_void, length: size_t) -> Result<()> { /// page. /// /// [`munlock(2)`]: https://man7.org/linux/man-pages/man2/munlock.2.html -pub unsafe fn munlock(addr: *const c_void, length: size_t) -> Result<()> { - Errno::result(libc::munlock(addr, length)).map(drop) +pub unsafe fn munlock(addr: NonNull, length: size_t) -> Result<()> { + Errno::result(libc::munlock(addr.as_ptr(), length)).map(drop) } /// Locks all memory pages mapped into this process' address space.