Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 51649:ba205f944cb4 stable
mmap: add a `is_mmap_safe` method to vfs
This will be useful to safeguard mmap usage to void SIGBUS when repositories
lives on a NFS drive.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 03 Jul 2024 12:22:48 +0200 |
parents | 59f846fbc11d |
children | 522b4d729e89 |
line wrap: on
line diff
--- a/mercurial/util.py Mon Jun 24 13:14:05 2024 +0200 +++ b/mercurial/util.py Wed Jul 03 12:22:48 2024 +0200 @@ -441,6 +441,13 @@ def mmapread(fp, size=None): + """Read a file content using mmap + + The responsability of checking the file system is mmap safe is the + responsability of the caller. + + In some case, a normal string might be returned. + """ if size == 0: # size of 0 to mmap.mmap() means "all data" # rather than "zero bytes", so special case that.