Skip to content

Commit

Permalink
feat mlock NonNull
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanWoollett-Light committed Nov 12, 2023
1 parent 512027b commit a8942ce
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`, `mprotect` and `munlock` updated to use `NonNull`.
`mmap`, `mmap_anonymous`, `munmap`, `mremap`, `madvise`, `msync`, `mprotect`, `munlock` and `mlock` 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 @@ -375,8 +375,8 @@ libc_bitflags! {
/// `addr` must meet all the requirements described in the [`mlock(2)`] man page.
///
/// [`mlock(2)`]: https://man7.org/linux/man-pages/man2/mlock.2.html
pub unsafe fn mlock(addr: *const c_void, length: size_t) -> Result<()> {
Errno::result(libc::mlock(addr, length)).map(drop)
pub unsafe fn mlock(addr: NonNull<c_void>, length: size_t) -> Result<()> {
Errno::result(libc::mlock(addr.as_ptr(), length)).map(drop)
}

/// Unlocks all memory pages that contain part of the address range with
Expand Down

0 comments on commit a8942ce

Please sign in to comment.