Skip to content

Commit cec801f

Browse files
committed
add mman::mprotect
1 parent f278094 commit cec801f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/sys/mman.rs

+4
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ pub unsafe fn madvise(addr: *mut c_void, length: size_t, advise: MmapAdvise) ->
258258
Errno::result(libc::madvise(addr, length, advise as i32)).map(drop)
259259
}
260260

261+
pub unsafe fn mprotect(addr: *mut c_void, length: size_t, prot: ProtFlags) -> Result<()> {
262+
Errno::result(libc::mprotect(addr, length, prot.bits())).map(drop)
263+
}
264+
261265
pub unsafe fn msync(addr: *mut c_void, length: size_t, flags: MsFlags) -> Result<()> {
262266
Errno::result(libc::msync(addr, length, flags.bits())).map(drop)
263267
}

0 commit comments

Comments
 (0)