Skip to content

Commit

Permalink
add mman::mprotect
Browse files Browse the repository at this point in the history
  • Loading branch information
acfoltzer committed Dec 5, 2018
1 parent f278094 commit cec801f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/sys/mman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ pub unsafe fn madvise(addr: *mut c_void, length: size_t, advise: MmapAdvise) ->
Errno::result(libc::madvise(addr, length, advise as i32)).map(drop)
}

pub unsafe fn mprotect(addr: *mut c_void, length: size_t, prot: ProtFlags) -> Result<()> {
Errno::result(libc::mprotect(addr, length, prot.bits())).map(drop)
}

pub unsafe fn msync(addr: *mut c_void, length: size_t, flags: MsFlags) -> Result<()> {
Errno::result(libc::msync(addr, length, flags.bits())).map(drop)
}
Expand Down

0 comments on commit cec801f

Please sign in to comment.