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.