Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netbsd add MAP_ALIGNED macro #3170

Merged
merged 1 commit into from Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions libc-test/semver/netbsd.txt
Expand Up @@ -628,6 +628,7 @@ MADV_NORMAL
MADV_RANDOM
MADV_SEQUENTIAL
MADV_WILLNEED
MAP_ALIGNED
MAP_ALIGNMENT_16MB
MAP_ALIGNMENT_1TB
MAP_ALIGNMENT_256TB
Expand Down
13 changes: 13 additions & 0 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Expand Up @@ -2384,6 +2384,19 @@ pub const GRND_NONBLOCK: ::c_uint = 0x1;
pub const GRND_RANDOM: ::c_uint = 0x2;
pub const GRND_INSECURE: ::c_uint = 0x4;

cfg_if! {

if #[cfg(libc_const_extern_fn)] {
pub const fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int {
alignment << MAP_ALIGNMENT_SHIFT
}
} else {
pub fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int {
alignment << MAP_ALIGNMENT_SHIFT
}
}
}

const_fn! {
{const} fn _ALIGN(p: usize) -> usize {
(p + _ALIGNBYTES) & !_ALIGNBYTES
Expand Down