Skip to content

Commit d79da57

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

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;
@@ -5601,6 +5601,18 @@ extern "C" {
56015601
) -> ::c_int;
56025602
}
56035603

5604+
cfg_if! {
5605+
if #[cfg(libc_const_extern_fn)] {
5606+
pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int {
5607+
a << 24
5608+
}
5609+
} else {
5610+
pub fn MAP_ALIGNED(a: ::c_int) -> ::c_int {
5611+
a << 24
5612+
}
5613+
}
5614+
}
5615+
56045616
cfg_if! {
56055617
if #[cfg(freebsd14)] {
56065618
mod freebsd14;

0 commit comments

Comments
 (0)