Skip to content

Commit b1bba41

Browse files
committed
netbsd add MAP_ALIGNED macro
1 parent 74e81a5 commit b1bba41

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
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: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,13 +1663,13 @@ pub const MAP_WIRED: ::c_int = 0x800;
16631663
pub const MAP_STACK: ::c_int = 0x2000;
16641664
// map alignment aliases for MAP_ALIGNED
16651665
pub const MAP_ALIGNMENT_SHIFT: ::c_int = 24;
1666-
pub const MAP_ALIGNMENT_MASK: ::c_int = 0xff << MAP_ALIGNMENT_SHIFT;
1667-
pub const MAP_ALIGNMENT_64KB: ::c_int = 16 << MAP_ALIGNMENT_SHIFT;
1668-
pub const MAP_ALIGNMENT_16MB: ::c_int = 24 << MAP_ALIGNMENT_SHIFT;
1669-
pub const MAP_ALIGNMENT_4GB: ::c_int = 32 << MAP_ALIGNMENT_SHIFT;
1670-
pub const MAP_ALIGNMENT_1TB: ::c_int = 40 << MAP_ALIGNMENT_SHIFT;
1671-
pub const MAP_ALIGNMENT_256TB: ::c_int = 48 << MAP_ALIGNMENT_SHIFT;
1672-
pub const MAP_ALIGNMENT_64PB: ::c_int = 56 << MAP_ALIGNMENT_SHIFT;
1666+
pub const MAP_ALIGNMENT_MASK: ::c_int = MAP_ALIGNED(0xff);
1667+
pub const MAP_ALIGNMENT_64KB: ::c_int = MAP_ALIGNED(16);
1668+
pub const MAP_ALIGNMENT_16MB: ::c_int = MAP_ALIGNED(24);
1669+
pub const MAP_ALIGNMENT_4GB: ::c_int = MAP_ALIGNED(32);
1670+
pub const MAP_ALIGNMENT_1TB: ::c_int = MAP_ALIGNED(40);
1671+
pub const MAP_ALIGNMENT_256TB: ::c_int = MAP_ALIGNED(48);
1672+
pub const MAP_ALIGNMENT_64PB: ::c_int = MAP_ALIGNED(56);
16731673
// mremap flag
16741674
pub const MAP_REMAPDUP: ::c_int = 0x004;
16751675

@@ -2467,6 +2467,10 @@ safe_f! {
24672467
dev |= minor & 0xff;
24682468
dev
24692469
}
2470+
2471+
pub {const} fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int {
2472+
alignment << MAP_ALIGNMENT_SHIFT
2473+
}
24702474
}
24712475

24722476
extern "C" {

0 commit comments

Comments
 (0)