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

freebsd add MAP_ALIGNED macro #3167

Merged
merged 1 commit into from Apr 9, 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
2 changes: 2 additions & 0 deletions libc-test/semver/freebsd.txt
Expand Up @@ -705,6 +705,8 @@ MALLOCX_ARENA
MALLOCX_ALIGN
MALLOCX_TCACHE
MALLOCX_ZERO
MAP_ALIGNED
MAP_ALIGNED_SUPER
MAP_COPY
MAP_EXCL
MAP_FILE
Expand Down
12 changes: 12 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Expand Up @@ -4670,6 +4670,18 @@ pub const SCTP_ASSOC_RESET_FAILED: ::c_int = 0x0008;
pub const SCTP_STREAM_CHANGE_DENIED: ::c_int = 0x0004;
pub const SCTP_STREAM_CHANGE_FAILED: ::c_int = 0x0008;

cfg_if! {
if #[cfg(libc_const_extern_fn)] {
pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int {
a << 24
}
} else {
pub fn MAP_ALIGNED(a: ::c_int) -> ::c_int {
a << 24
}
}
}

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