Skip to content

Commit 03eebbf

Browse files
committed
freebsd add MAP_ALIGNED macro
1 parent 74e81a5 commit 03eebbf

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

libc-test/semver/freebsd.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,8 @@ MALLOCX_ARENA
702702
MALLOCX_ALIGN
703703
MALLOCX_TCACHE
704704
MALLOCX_ZERO
705+
MAP_ALIGNED
706+
MAP_ALIGNED_SUPER
705707
MAP_COPY
706708
MAP_EXCL
707709
MAP_FILE

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2664,7 +2664,7 @@ pub const Q_SETQUOTA: ::c_int = 0x800;
26642664
pub const MAP_GUARD: ::c_int = 0x00002000;
26652665
pub const MAP_EXCL: ::c_int = 0x00004000;
26662666
pub const MAP_PREFAULT_READ: ::c_int = 0x00040000;
2667-
pub const MAP_ALIGNED_SUPER: ::c_int = 1 << 24;
2667+
pub const MAP_ALIGNED_SUPER: ::c_int = MAP_ALIGNED(1);
26682668

26692669
pub const POSIX_FADV_NORMAL: ::c_int = 0;
26702670
pub const POSIX_FADV_RANDOM: ::c_int = 1;
@@ -4659,6 +4659,18 @@ pub const SCTP_ASSOC_RESET_FAILED: ::c_int = 0x0008;
46594659
pub const SCTP_STREAM_CHANGE_DENIED: ::c_int = 0x0004;
46604660
pub const SCTP_STREAM_CHANGE_FAILED: ::c_int = 0x0008;
46614661

4662+
cfg_if! {
4663+
if #[cfg(libc_const_extern_fn)] {
4664+
pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int {
4665+
a << 24
4666+
}
4667+
} else {
4668+
pub fn MAP_ALIGNED(a: ::c_int) -> ::c_int {
4669+
a << 24
4670+
}
4671+
}
4672+
}
4673+
46624674
const_fn! {
46634675
{const} fn _ALIGN(p: usize) -> usize {
46644676
(p + _ALIGNBYTES) & !_ALIGNBYTES

0 commit comments

Comments
 (0)