Skip to content

Commit

Permalink
Auto merge of #3170 - devnexen:netbsd_map_aligned, r=JohnTitor
Browse files Browse the repository at this point in the history
netbsd add MAP_ALIGNED macro
  • Loading branch information
bors committed Mar 27, 2023
2 parents 9ac18cd + b1bba41 commit f9205ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions libc-test/semver/netbsd.txt
Expand Up @@ -628,6 +628,7 @@ MADV_NORMAL
MADV_RANDOM
MADV_SEQUENTIAL
MADV_WILLNEED
MAP_ALIGNED
MAP_ALIGNMENT_16MB
MAP_ALIGNMENT_1TB
MAP_ALIGNMENT_256TB
Expand Down
18 changes: 11 additions & 7 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Expand Up @@ -1663,13 +1663,13 @@ pub const MAP_WIRED: ::c_int = 0x800;
pub const MAP_STACK: ::c_int = 0x2000;
// map alignment aliases for MAP_ALIGNED
pub const MAP_ALIGNMENT_SHIFT: ::c_int = 24;
pub const MAP_ALIGNMENT_MASK: ::c_int = 0xff << MAP_ALIGNMENT_SHIFT;
pub const MAP_ALIGNMENT_64KB: ::c_int = 16 << MAP_ALIGNMENT_SHIFT;
pub const MAP_ALIGNMENT_16MB: ::c_int = 24 << MAP_ALIGNMENT_SHIFT;
pub const MAP_ALIGNMENT_4GB: ::c_int = 32 << MAP_ALIGNMENT_SHIFT;
pub const MAP_ALIGNMENT_1TB: ::c_int = 40 << MAP_ALIGNMENT_SHIFT;
pub const MAP_ALIGNMENT_256TB: ::c_int = 48 << MAP_ALIGNMENT_SHIFT;
pub const MAP_ALIGNMENT_64PB: ::c_int = 56 << MAP_ALIGNMENT_SHIFT;
pub const MAP_ALIGNMENT_MASK: ::c_int = MAP_ALIGNED(0xff);
pub const MAP_ALIGNMENT_64KB: ::c_int = MAP_ALIGNED(16);
pub const MAP_ALIGNMENT_16MB: ::c_int = MAP_ALIGNED(24);
pub const MAP_ALIGNMENT_4GB: ::c_int = MAP_ALIGNED(32);
pub const MAP_ALIGNMENT_1TB: ::c_int = MAP_ALIGNED(40);
pub const MAP_ALIGNMENT_256TB: ::c_int = MAP_ALIGNED(48);
pub const MAP_ALIGNMENT_64PB: ::c_int = MAP_ALIGNED(56);
// mremap flag
pub const MAP_REMAPDUP: ::c_int = 0x004;

Expand Down Expand Up @@ -2467,6 +2467,10 @@ safe_f! {
dev |= minor & 0xff;
dev
}

pub {const} fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int {
alignment << MAP_ALIGNMENT_SHIFT
}
}

extern "C" {
Expand Down

0 comments on commit f9205ec

Please sign in to comment.