diff options
author | David Carlier <devnexen@gmail.com> | 2023-03-26 17:07:19 +0100 |
---|---|---|
committer | David CARLIER <devnexen@gmail.com> | 2023-04-04 21:09:25 +0100 |
commit | b9f3f0a60810fd99dd8d641d2b86d4dba573c52e (patch) | |
tree | 6acf77298887e8f9e0b8a6cb0ae98169ae87ce59 | |
parent | b9f037292b144a416a454ca457c6d6f94662a59e (diff) | |
download | rust-libc-b9f3f0a60810fd99dd8d641d2b86d4dba573c52e.tar.gz |
netbsd add MAP_ALIGNED macro
-rw-r--r-- | libc-test/semver/netbsd.txt | 1 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/mod.rs | 13 |
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 |