-
Notifications
You must be signed in to change notification settings - Fork 410
Fix mmap() conditions #487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Could you give me an example of something that gets mmap'ed now that wasn't getting mmap'ed before? Is there something under The original |
|
In fact I think |
|
The main driver for this is devices; Why would it check that? This is a valid map: (this is 2^31+100000010). It's not possible to make a file bigger than 2^63-1 (but even if it weren't, the map would just fail as usual when you give it a length that's too big). |
Get the file size from seeking to the end (canonical, equivalent to File::stream_len()) instead of fstat(); this is more real and unseekable files are unmappable (conversely, in the vast majority of cases, seekable files are mappable) Always try to map (size permitting) instead of only mapping S_IFREGs and fall back to reading on failure (instead of hard-erroring). This means we can map devices and correctly fall back if the mapping failed for any number of inocuous reasons (mapping too big, too many mappings, whatever) This also ends up faster (lseek()+mmap() instead of statx()+statx()+mmap()) Modelled after https://git.sr.ht/~nabijaczleweli/voreutils/commit/e4621ad93ae69d28c032932ad617c026790c0a40
|
CI failure appears unrelated |
|
RazrFalcon/memmap2-rs#145 merged |
|
...and now rebuilding this picks up memmap2 0.9.7 which has the check implemented |
Get the file size from seeking to the end (canonical, equivalent to File::stream_len()) instead of fstat(); this is more real and unseekable files are unmappable (conversely, in the vast majority of cases, seekable files are mappable)
Always try to map (size permitting) instead of only mapping S_IFREGs and fall back to reading on failure (instead of hard-erroring). This means we can map devices and correctly fall back if the mapping failed for any number of inocuous reasons (mapping too big, too many mappings, whatever)
This also ends up faster (lseek()+mmap() instead of statx()+statx()+mmap())
Modelled after https://git.sr.ht/~nabijaczleweli/voreutils/commit/e4621ad93ae69d28c032932ad617c026790c0a40