mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-28 04:03:39 +08:00
Don't try locking the history file if mmap returns ENODEV
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
If we try to memory map the history file, and we get back ENODEV meaning that the underlying device does not support memory mapping, then treat that as a hint that the filesystem is remote and disable history locking.
This commit is contained in:
parent
344b072e82
commit
23941ea9ca
|
@ -130,7 +130,15 @@ impl HistoryFileContents {
|
|||
let region = if should_mmap() {
|
||||
match MmapRegion::map_file(file.as_raw_fd(), len) {
|
||||
Ok(region) => region,
|
||||
Err(err) if err.raw_os_error() == Some(ENODEV) => map_anon(file, len)?,
|
||||
Err(err) if err.raw_os_error() == Some(ENODEV) => {
|
||||
// Our mmap failed with ENODEV, which means the underlying
|
||||
// filesystem does not support mapping. Treat this as a hint
|
||||
// that the filesystem is remote, and so disable locks for
|
||||
// the history file.
|
||||
super::ABANDONED_LOCKING.store(true);
|
||||
// Create an anonymous mapping and read() the file into it.
|
||||
map_anon(file, len)?
|
||||
}
|
||||
Err(_err) => return None,
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user