From 5f0072130e3d5e942601cc06da9934f2e3ab5c07 Mon Sep 17 00:00:00 2001 From: Ryan Zoeller Date: Tue, 18 Jan 2022 16:42:52 -0600 Subject: [PATCH] Add MAP_FIXED_NOREPLACE on Linux --- CHANGELOG.md | 2 ++ src/sys/mman.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75fc82def4..05a28ca412 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). (#[1615](https://github.com/nix-rust/nix/pull/1615)) - Added `getresuid`, `setresuid`, `getresgid`, and `setresgid` on DragonFly, FreeBSD, and OpenBSD. (#[1628](https://github.com/nix-rust/nix/pull/1628)) +- Added `MAP_FIXED_NOREPLACE` on Linux. + (#[1636](https://github.com/nix-rust/nix/pull/1636)) ### Changed ### Fixed diff --git a/src/sys/mman.rs b/src/sys/mman.rs index 7302a65a2f..523b468341 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -43,6 +43,10 @@ libc_bitflags!{ MAP_PRIVATE; /// Place the mapping at exactly the address specified in `addr`. MAP_FIXED; + /// Place the mapping at exactly the address specified in `addr`, but never clobber an existing range. + #[cfg(target_os = "linux")] + #[cfg_attr(docsrs, doc(cfg(all())))] + MAP_FIXED_NOREPLACE; /// To be used with `MAP_FIXED`, to forbid the system /// to select a different address than the one specified. #[cfg(target_os = "freebsd")]