summaryrefslogtreecommitdiffstats
path: root/vendor/memmap2
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /vendor/memmap2
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/memmap2')
-rw-r--r--vendor/memmap2/.cargo-checksum.json2
-rw-r--r--vendor/memmap2/CHANGELOG.md16
-rw-r--r--vendor/memmap2/Cargo.lock14
-rw-r--r--vendor/memmap2/Cargo.toml2
-rw-r--r--vendor/memmap2/src/lib.rs59
-rw-r--r--vendor/memmap2/src/stub.rs2
-rw-r--r--vendor/memmap2/src/unix.rs12
-rw-r--r--vendor/memmap2/src/windows.rs2
8 files changed, 89 insertions, 20 deletions
diff --git a/vendor/memmap2/.cargo-checksum.json b/vendor/memmap2/.cargo-checksum.json
index 656d284c6..a4b288791 100644
--- a/vendor/memmap2/.cargo-checksum.json
+++ b/vendor/memmap2/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"2c44b332748c22db37c7bc17f8c90edd5616c084a9b7238eef5067f3dd287813","Cargo.lock":"ed33b2c7bd22c158bd527fefa4079e62a3e98a63c2b653ba50d977a8a43f92c2","Cargo.toml":"cad69c38d627420a71d549945b9bbc4b21323b2855d63e3b98d344d2fe3ea07e","LICENSE-APACHE":"04ea4849dba9dcae07113850c6f1b1a69052c625210639914eee352023f750ad","LICENSE-MIT":"0d25d03b5ab49576178ad0cae7a2648d12c17ad0452fe49c07e55e4b59aa5257","README.md":"c7b3cd928f0d1a10faa255e2f84a2a06636e55ea3e7edd4f6334dd9215151205","examples/cat.rs":"ab0b575d19662e2d5b6c7cea2756b57530e495d56acdb4fd2b56c0ba4d768dfd","src/advice.rs":"194bfd6a32495f6b0c739d083b06230ae656927767f15c1b49b245b63431cc4d","src/lib.rs":"4f345df103c78344e07454da7b8f3941af094efd599e3d51a29ea735fab19dba","src/stub.rs":"f276bb5e4bc29c2129ebc660b01a1de173b9575e2e866ea5a34e0ee6318f1177","src/unix.rs":"03fe91a320d0146993019ea51e486275b8c8e13e42a995e649b8c76690e3f167","src/windows.rs":"bbb39200ac35b5517626c12efad4886f7b5d34e56256284914c556dec1567e38"},"package":"4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"143d630cecf87bfeb628f948b49a1fec71a95f803eb657caba7035c05070d4d3","Cargo.lock":"618e672a49a6cc6d39a284a84729e6712a529293e2bfb6cb49c83f4b95fd2a41","Cargo.toml":"cbf8d835df0ae240cd6ce717346d698eca65f15319d84053c5a40372415d2c9d","LICENSE-APACHE":"04ea4849dba9dcae07113850c6f1b1a69052c625210639914eee352023f750ad","LICENSE-MIT":"0d25d03b5ab49576178ad0cae7a2648d12c17ad0452fe49c07e55e4b59aa5257","README.md":"c7b3cd928f0d1a10faa255e2f84a2a06636e55ea3e7edd4f6334dd9215151205","examples/cat.rs":"ab0b575d19662e2d5b6c7cea2756b57530e495d56acdb4fd2b56c0ba4d768dfd","src/advice.rs":"194bfd6a32495f6b0c739d083b06230ae656927767f15c1b49b245b63431cc4d","src/lib.rs":"86af155500a6bdf8bd2e63f4f722ba576f35e0ae12635ba08ec050103b4e2c1c","src/stub.rs":"691da940edbe807a815d4a6bb3233df01bca8ab12b306ce7d67c75b4baa14e26","src/unix.rs":"dc145b2b3ac2be5ab2df56f14ed1ed7b29a2ac718886c3a5786fa45c2e155c8c","src/windows.rs":"1fbf828360e2c3c4808684d1075f45c5e149459046e254b413118e596badf381"},"package":"83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327"} \ No newline at end of file
diff --git a/vendor/memmap2/CHANGELOG.md b/vendor/memmap2/CHANGELOG.md
index 07b4eb270..b6132dac0 100644
--- a/vendor/memmap2/CHANGELOG.md
+++ b/vendor/memmap2/CHANGELOG.md
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
+## [0.5.10] - 2023-02-22
+### Added
+- `MmapOptions::map_anon` accounts for `populate` on Linux now.
+ [@jsgf](https://github.com/jsgf)
+
+## [0.5.9] - 2023-02-17
+### Added
+- `From<Mmap> for MmapRaw` and `From<MmapMut> for MmapRaw`.
+ [@swlynch99](https://github.com/swlynch99)
+- `Mmap::advise_range`, `MmapMut::advise_range`, `MmapRaw::advise_range`.
+ [@ho-229](https://github.com/ho-229)
+
## [0.5.8] - 2022-11-09
### Added
- `MmapRaw::advise`, `MmapRaw::lock` and `MmapRaw::unlock`.
@@ -123,7 +135,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed
- `winapi` dependency. [memmap-rs/pull/89](https://github.com/danburkert/memmap-rs/pull/89)
-[Unreleased]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.8...HEAD
+[Unreleased]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.10...HEAD
+[0.5.10]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.9...v0.5.10
+[0.5.9]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.8...v0.5.9
[0.5.8]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.7...v0.5.8
[0.5.7]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.6...v0.5.7
[0.5.6]: https://github.com/RazrFalcon/memmap2-rs/compare/v0.5.5...v0.5.6
diff --git a/vendor/memmap2/Cargo.lock b/vendor/memmap2/Cargo.lock
index f5fe93bb2..80121fa1e 100644
--- a/vendor/memmap2/Cargo.lock
+++ b/vendor/memmap2/Cargo.lock
@@ -16,9 +16,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "fastrand"
-version = "1.7.0"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
+checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
"instant",
]
@@ -34,13 +34,13 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.99"
+version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765"
+checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "memmap2"
-version = "0.5.8"
+version = "0.5.10"
dependencies = [
"libc",
"owning_ref",
@@ -59,9 +59,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
-version = "0.2.13"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
+checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
diff --git a/vendor/memmap2/Cargo.toml b/vendor/memmap2/Cargo.toml
index 9c3575f9b..acffd6fdf 100644
--- a/vendor/memmap2/Cargo.toml
+++ b/vendor/memmap2/Cargo.toml
@@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "memmap2"
-version = "0.5.8"
+version = "0.5.10"
authors = [
"Dan Burkert <dan@danburkert.com>",
"Yevhenii Reizner <razrfalcon@gmail.com>",
diff --git a/vendor/memmap2/src/lib.rs b/vendor/memmap2/src/lib.rs
index 58df7589b..2d730ae90 100644
--- a/vendor/memmap2/src/lib.rs
+++ b/vendor/memmap2/src/lib.rs
@@ -482,7 +482,7 @@ impl MmapOptions {
));
}
- MmapInner::map_anon(len, self.stack).map(|inner| MmapMut { inner })
+ MmapInner::map_anon(len, self.stack, self.populate).map(|inner| MmapMut { inner })
}
/// Creates a raw memory map.
@@ -627,7 +627,19 @@ impl Mmap {
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
#[cfg(unix)]
pub fn advise(&self, advice: Advice) -> Result<()> {
- self.inner.advise(advice)
+ self.inner.advise(advice, 0, self.inner.len())
+ }
+
+ /// Advise OS how this range of memory map will be accessed.
+ ///
+ /// The offset and length must be in the bounds of the memory map.
+ ///
+ /// Only supported on Unix.
+ ///
+ /// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
+ #[cfg(unix)]
+ pub fn advise_range(&self, advice: Advice, offset: usize, len: usize) -> Result<()> {
+ self.inner.advise(advice, offset, len)
}
/// Lock the whole memory map into RAM. Only supported on Unix.
@@ -806,7 +818,19 @@ impl MmapRaw {
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
#[cfg(unix)]
pub fn advise(&self, advice: Advice) -> Result<()> {
- self.inner.advise(advice)
+ self.inner.advise(advice, 0, self.inner.len())
+ }
+
+ /// Advise OS how this range of memory map will be accessed.
+ ///
+ /// The offset and length must be in the bounds of the memory map.
+ ///
+ /// Only supported on Unix.
+ ///
+ /// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
+ #[cfg(unix)]
+ pub fn advise_range(&self, advice: Advice, offset: usize, len: usize) -> Result<()> {
+ self.inner.advise(advice, offset, len)
}
/// Lock the whole memory map into RAM. Only supported on Unix.
@@ -835,6 +859,18 @@ impl fmt::Debug for MmapRaw {
}
}
+impl From<Mmap> for MmapRaw {
+ fn from(value: Mmap) -> Self {
+ Self { inner: value.inner }
+ }
+}
+
+impl From<MmapMut> for MmapRaw {
+ fn from(value: MmapMut) -> Self {
+ Self { inner: value.inner }
+ }
+}
+
/// A handle to a mutable memory mapped buffer.
///
/// A file-backed `MmapMut` buffer may be used to read from or write to a file. An anonymous
@@ -1050,7 +1086,19 @@ impl MmapMut {
/// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
#[cfg(unix)]
pub fn advise(&self, advice: Advice) -> Result<()> {
- self.inner.advise(advice)
+ self.inner.advise(advice, 0, self.inner.len())
+ }
+
+ /// Advise OS how this range of memory map will be accessed.
+ ///
+ /// The offset and length must be in the bounds of the memory map.
+ ///
+ /// Only supported on Unix.
+ ///
+ /// See [madvise()](https://man7.org/linux/man-pages/man2/madvise.2.html) map page.
+ #[cfg(unix)]
+ pub fn advise_range(&self, advice: Advice, offset: usize, len: usize) -> Result<()> {
+ self.inner.advise(advice, offset, len)
}
/// Lock the whole memory map into RAM. Only supported on Unix.
@@ -1633,6 +1681,9 @@ mod test {
// check that the mmap is empty
assert_eq!(&zeros[..], &mmap[..]);
+ mmap.advise_range(Advice::Sequential, 0, mmap.len())
+ .expect("mmap advising should be supported on unix");
+
// write values into the mmap
(&mut mmap[..]).write_all(&incr[..]).unwrap();
diff --git a/vendor/memmap2/src/stub.rs b/vendor/memmap2/src/stub.rs
index e756da4f6..3c6af0e77 100644
--- a/vendor/memmap2/src/stub.rs
+++ b/vendor/memmap2/src/stub.rs
@@ -36,7 +36,7 @@ impl MmapInner {
MmapInner::new()
}
- pub fn map_anon(_: usize, _: bool) -> io::Result<MmapInner> {
+ pub fn map_anon(_: usize, _: bool, _: bool) -> io::Result<MmapInner> {
MmapInner::new()
}
diff --git a/vendor/memmap2/src/unix.rs b/vendor/memmap2/src/unix.rs
index 158d78c1f..221d3ba84 100644
--- a/vendor/memmap2/src/unix.rs
+++ b/vendor/memmap2/src/unix.rs
@@ -162,12 +162,13 @@ impl MmapInner {
}
/// Open an anonymous memory map.
- pub fn map_anon(len: usize, stack: bool) -> io::Result<MmapInner> {
+ pub fn map_anon(len: usize, stack: bool, populate: bool) -> io::Result<MmapInner> {
let stack = if stack { MAP_STACK } else { 0 };
+ let populate = if populate { MAP_POPULATE } else { 0 };
MmapInner::new(
len,
libc::PROT_READ | libc::PROT_WRITE,
- libc::MAP_PRIVATE | libc::MAP_ANON | stack,
+ libc::MAP_PRIVATE | libc::MAP_ANON | stack | populate,
-1,
0,
)
@@ -240,9 +241,12 @@ impl MmapInner {
self.len
}
- pub fn advise(&self, advice: Advice) -> io::Result<()> {
+ pub fn advise(&self, advice: Advice, offset: usize, len: usize) -> io::Result<()> {
+ let alignment = (self.ptr as usize + offset) % page_size();
+ let offset = offset as isize - alignment as isize;
+ let len = len + alignment;
unsafe {
- if libc::madvise(self.ptr, self.len, advice as i32) != 0 {
+ if libc::madvise(self.ptr.offset(offset), len, advice as i32) != 0 {
Err(io::Error::last_os_error())
} else {
Ok(())
diff --git a/vendor/memmap2/src/windows.rs b/vendor/memmap2/src/windows.rs
index d580995e6..c1b1a4d9f 100644
--- a/vendor/memmap2/src/windows.rs
+++ b/vendor/memmap2/src/windows.rs
@@ -340,7 +340,7 @@ impl MmapInner {
Ok(inner)
}
- pub fn map_anon(len: usize, _stack: bool) -> io::Result<MmapInner> {
+ pub fn map_anon(len: usize, _stack: bool, _populate: bool) -> io::Result<MmapInner> {
// Ensure a non-zero length for the underlying mapping
let mapped_len = len.max(1);
unsafe {