From f056c86dabd2835aa6029fda254acbb206a38a92 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 10 Dec 2023 08:42:52 +0000 Subject: [PATCH] sys::mman adding MMAP_TRYFIXED for netbsdlike platforms. --- Cargo.toml | 2 +- changelog/2260.added.md | 1 + src/sys/mman.rs | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog/2260.added.md diff --git a/Cargo.toml b/Cargo.toml index 06302aac6d..38fc390087 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ targets = [ ] [dependencies] -libc = { git = "/~https://github.com/rust-lang/libc", rev = "497ac428bc010b5db9682ecf94cd567b31d53e5c", features = ["extra_traits"] } +libc = { git = "/~https://github.com/rust-lang/libc", rev = "f37806e499409eab8cfa897280a869bc5e2623a9", features = ["extra_traits"] } bitflags = "2.3.1" cfg-if = "1.0" pin-utils = { version = "0.1.0", optional = true } diff --git a/changelog/2260.added.md b/changelog/2260.added.md new file mode 100644 index 0000000000..6ab54f3082 --- /dev/null +++ b/changelog/2260.added.md @@ -0,0 +1 @@ +Added `MmapFlags::MAP_FIXED` constant in `sys::mman` for netbsd and openbsd diff --git a/src/sys/mman.rs b/src/sys/mman.rs index 3518662756..a64f14f588 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -154,6 +154,10 @@ libc_bitflags! { /// Pages will be discarded in the core dumps. #[cfg(target_os = "openbsd")] MAP_CONCEAL; + /// Attempt to place the mapping at exactly the address specified in `addr`. + /// it's a default behavior on OpenBSD. + #[cfg(netbsdlike)] + MAP_TRYFIXED; } }