Skip to content

Commit

Permalink
Revert mmap changes
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Nov 5, 2023
1 parent 21f6825 commit b3dc608
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/sys/mman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,14 @@ pub unsafe fn mmap<F: AsFd>(
length: NonZeroUsize,
prot: ProtFlags,
flags: MapFlags,
f: F,
f: Option<F>,
offset: off_t,
) -> Result<*mut c_void> {
let ptr = addr.map_or(std::ptr::null_mut(), |a| a.get() as *mut c_void);
let ptr =
addr.map_or(std::ptr::null_mut(), |a| usize::from(a) as *mut c_void);


let fd = f.as_fd().as_raw_fd();
let fd = f.map(|f| f.as_fd().as_raw_fd()).unwrap_or(-1);
let ret =
libc::mmap(ptr, length.into(), prot.bits(), flags.bits(), fd, offset);

Expand Down

0 comments on commit b3dc608

Please sign in to comment.