Skip to content

Commit 66171ee

Browse files
committed
Auto merge of #3170 - devnexen:netbsd_map_aligned, r=JohnTitor
netbsd add MAP_ALIGNED macro
2 parents b9f0372 + b9f3f0a commit 66171ee

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

libc-test/semver/netbsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ MADV_NORMAL
628628
MADV_RANDOM
629629
MADV_SEQUENTIAL
630630
MADV_WILLNEED
631+
MAP_ALIGNED
631632
MAP_ALIGNMENT_16MB
632633
MAP_ALIGNMENT_1TB
633634
MAP_ALIGNMENT_256TB

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,6 +2384,19 @@ pub const GRND_NONBLOCK: ::c_uint = 0x1;
23842384
pub const GRND_RANDOM: ::c_uint = 0x2;
23852385
pub const GRND_INSECURE: ::c_uint = 0x4;
23862386

2387+
cfg_if! {
2388+
2389+
if #[cfg(libc_const_extern_fn)] {
2390+
pub const fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int {
2391+
alignment << MAP_ALIGNMENT_SHIFT
2392+
}
2393+
} else {
2394+
pub fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int {
2395+
alignment << MAP_ALIGNMENT_SHIFT
2396+
}
2397+
}
2398+
}
2399+
23872400
const_fn! {
23882401
{const} fn _ALIGN(p: usize) -> usize {
23892402
(p + _ALIGNBYTES) & !_ALIGNBYTES

0 commit comments

Comments
 (0)