Skip to content

Commit

Permalink
feat: munlock NonNull
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanWoollett-Light committed Nov 13, 2023
1 parent f318f4b commit 0099bd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion changelog/2000.changed.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
`mmap`, `mmap_anonymous`, `munmap`, `mremap`, `madvise`, `msync` and `mprotect` updated to use `NonNull`.
`mmap`, `mmap_anonymous`, `munmap`, `mremap`, `madvise`, `msync`, `mprotect` and `munlock` updated to use `NonNull`.
4 changes: 2 additions & 2 deletions src/sys/mman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<c_void>, length: size_t) -> Result<()> {
Errno::result(libc::munlock(addr.as_ptr(), length)).map(drop)
}

/// Locks all memory pages mapped into this process' address space.
Expand Down

0 comments on commit 0099bd9

Please sign in to comment.