From e6c1c657cb83a11bfc119dab5d458b8699dbe6f9 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sat, 25 Mar 2023 17:38:48 +0000 Subject: [PATCH] freebsd add MAP_ALIGNED macro --- libc-test/semver/freebsd.txt | 2 ++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index eadb4e9c73b56..5776e8a421471 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -705,6 +705,8 @@ MALLOCX_ARENA MALLOCX_ALIGN MALLOCX_TCACHE MALLOCX_ZERO +MAP_ALIGNED +MAP_ALIGNED_SUPER MAP_COPY MAP_EXCL MAP_FILE diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 55b520faabe21..2ee676d973dc6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -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