diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 3dc84da635963..b8fd4a194cd36 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -628,6 +628,7 @@ MADV_NORMAL MADV_RANDOM MADV_SEQUENTIAL MADV_WILLNEED +MAP_ALIGNED MAP_ALIGNMENT_16MB MAP_ALIGNMENT_1TB MAP_ALIGNMENT_256TB diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index fd7175583e9a9..b100b3e14259a 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -2384,6 +2384,19 @@ pub const GRND_NONBLOCK: ::c_uint = 0x1; pub const GRND_RANDOM: ::c_uint = 0x2; pub const GRND_INSECURE: ::c_uint = 0x4; +cfg_if! { + + if #[cfg(libc_const_extern_fn)] { + pub const fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int { + alignment << MAP_ALIGNMENT_SHIFT + } + } else { + pub fn MAP_ALIGNED(alignment: ::c_int) -> ::c_int { + alignment << MAP_ALIGNMENT_SHIFT + } + } +} + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES