Skip to content

Commit

Permalink
adding map_aligned feature separately, in case.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Aug 7, 2023
1 parent 346c22f commit 688cfe2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sys/mman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,3 +637,13 @@ pub fn shm_unlink<P: ?Sized + NixPath>(name: &P) -> Result<()> {

Errno::result(ret).map(drop)
}

/// Matches BSD's `MAP_ALIGNED(x)` macro, x being ilog2(alignment).
///
/// For more information, see [`mmap(2)`].
///
/// [`mmap(2)`]: https://man.freebsd.org/cgi/man.cgi?mmap(2)
#[cfg(any(target_os = "netbsd", target_os = "freebsd"))]
pub const fn map_aligned(v: u32) -> u32 {
v << MapFlags::MAP_ALIGNMENT_SHIFT.bits()
}

0 comments on commit 688cfe2

Please sign in to comment.