summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2023-03-26 17:07:19 +0100
committerDavid CARLIER <devnexen@gmail.com>2023-04-04 21:09:25 +0100
commitb9f3f0a60810fd99dd8d641d2b86d4dba573c52e (patch)
tree6acf77298887e8f9e0b8a6cb0ae98169ae87ce59
parentb9f037292b144a416a454ca457c6d6f94662a59e (diff)
downloadrust-libc-b9f3f0a60810fd99dd8d641d2b86d4dba573c52e.tar.gz
netbsd add MAP_ALIGNED macro
-rw-r--r--libc-test/semver/netbsd.txt1
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs13
2 files changed, 14 insertions, 0 deletions
diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt
index 3dc84da635..b8fd4a194c 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 fd7175583e..b100b3e142 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