summaryrefslogtreecommitdiffstats
path: root/src/worker.rs
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-03-10 08:12:24 -0500
committerAndrew Gallant <jamslam@gmail.com>2018-03-10 08:13:27 -0500
commitdbf6f15625dfa395cdea2675b2a7c24e743a1197 (patch)
tree091ff345dde49bdcf36f6d62a1cba948720a5896 /src/worker.rs
parent9163aaac277f6db9938f464d78d212a0e8997c59 (diff)
mmap: handle ENOMEM error
This commit causes a memory map strategy to fall back to a file backed strategy if the mmap call fails with an `ENOMEM` error. Fixes #852
Diffstat (limited to 'src/worker.rs')
-rw-r--r--src/worker.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/worker.rs b/src/worker.rs
index eee7c67f..952a334b 100644
--- a/src/worker.rs
+++ b/src/worker.rs
@@ -341,14 +341,17 @@ impl Worker {
#[cfg(unix)]
fn mmap(&self, file: &File) -> Result<Option<Mmap>> {
- use libc::{ENODEV, EOVERFLOW};
+ use libc::{EOVERFLOW, ENODEV, ENOMEM};
let err = match mmap_readonly(file) {
Ok(mmap) => return Ok(Some(mmap)),
Err(err) => err,
};
let code = err.raw_os_error();
- if code == Some(ENODEV) || code == Some(EOVERFLOW) {
+ if code == Some(EOVERFLOW)
+ || code == Some(ENODEV)
+ || code == Some(ENOMEM)
+ {
return Ok(None);
}
Err(From::from(err))