summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-04-22 01:03:15 +0000
committerGitHub <noreply@github.com>2020-04-22 01:03:15 +0000
commitf54b5a8b8dcea03c98091da1c1ed4fe7bb3b7642 (patch)
tree821b5b4d1333d4cd2b16ca8c32d2f21ff213fb5b
parent109e8b455b2a5debc0e62c60b7300abd3a6b3f0d (diff)
parentd7a725d88bf3704cd26bc779274265b310ac4b00 (diff)
downloadnix-f54b5a8b8dcea03c98091da1c1ed4fe7bb3b7642.zip
Merge #1211
1211: Feature/hugepage size r=asomers a=GuillaumeDIDIER Should solve #1194 . Co-authored-by: GuillaumeDIDIER <guillaume.didier95@hotmail.fr>
-rw-r--r--CHANGELOG.md4
-rw-r--r--Cargo.toml2
-rw-r--r--src/sys/mman.rs37
3 files changed, 41 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 14e73e42..f5f0d832 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] - ReleaseDate
### Added
+- Added support on linux systems for `MAP_HUGE_`_`SIZE`_ family of flags.
+ (#[1211](https://github.com/nix-rust/nix/pull/1211))
- Added support for `F_OFD_*` `fcntl` commands on Linux and Android.
(#[1195](https://github.com/nix-rust/nix/pull/1195))
- Added `env::clearenv()`: calls `libc::clearenv` on platforms
@@ -125,7 +127,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
// old code `readlink(&path, &mut buf)` can be replaced with the following
let _: OsString = readlink(&path);
-
+
// old code `readlinkat(dirfd, &path, &mut buf)` can be replaced with the following
let _: OsString = readlinkat(dirfd, &path);
```
diff --git a/Cargo.toml b/Cargo.toml
index 9d4711f1..22186397 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ exclude = [
]
[dependencies]
-libc = { version = "0.2.68", features = [ "extra_traits" ] }
+libc = { git = "https://github.com/rust-lang/libc/", features = [ "extra_traits" ] }
bitflags = "1.1"
cfg-if = "0.1.10"
void = "1.0.2"
diff --git a/src/sys/mman.rs b/src/sys/mman.rs
index 4e250501..dfa46264 100644
--- a/src/sys/mman.rs
+++ b/src/sys/mman.rs
@@ -77,6 +77,43 @@ libc_bitflags!{
/// Allocate the mapping using "huge pages."
#[cfg(any(target_os = "android", target_os = "linux"))]
MAP_HUGETLB;
+ /// Make use of 64KB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_64KB;
+ /// Make use of 512KB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_512KB;
+ /// Make use of 1MB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_1MB;
+ /// Make use of 2MB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_2MB;
+ /// Make use of 8MB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_8MB;
+ /// Make use of 16MB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_16MB;
+ /// Make use of 32MB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_32MB;
+ /// Make use of 256MB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_256MB;
+ /// Make use of 512MB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_512MB;
+ /// Make use of 1GB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_1GB;
+ /// Make use of 2GB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_2GB;
+ /// Make use of 16GB huge page (must be supported by the system)
+ #[cfg(target_os = "linux")]
+ MAP_HUGE_16GB;
+
/// Lock the mapped region into memory as with `mlock(2)`.
#[cfg(target_os = "netbsd")]
MAP_WIRED;