Skip to content

Commit

Permalink
feat: madvise NonNull
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanWoollett-Light committed Nov 12, 2023
1 parent 05dc692 commit df604d2
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` and `mremap` updated to use `NonNull`.
`mmap`, `mmap_anonymous`, `munmap`, `mremap` and `madvise` 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 @@ -534,11 +534,11 @@ pub unsafe fn munmap(mut addr: NonNull<c_void>, len: size_t) -> Result<()> {
///
/// [`madvise(2)`]: https://man7.org/linux/man-pages/man2/madvise.2.html
pub unsafe fn madvise(
addr: *mut c_void,
addr: NonNull<c_void>,
length: size_t,
advise: MmapAdvise,
) -> Result<()> {
Errno::result(libc::madvise(addr, length, advise as i32)).map(drop)
Errno::result(libc::madvise(addr.as_ptr(), length, advise as i32)).map(drop)
}

/// Set protection of memory mapping.
Expand Down

0 comments on commit df604d2

Please sign in to comment.