comparison mercurial/util.py @ 51927:2d51b0cf707c

util: minor copy editing of the documentation for `mmapread()`
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 01 Oct 2024 15:04:06 -0400
parents bc9ed92d4753
children fa7059f031a9
comparison
equal deleted inserted replaced
51926:bc9ed92d4753 51927:2d51b0cf707c
466 466
467 467
468 def mmapread(fp, size=None, pre_populate=True): 468 def mmapread(fp, size=None, pre_populate=True):
469 """Read a file content using mmap 469 """Read a file content using mmap
470 470
471 The responsability of checking the file system is mmap safe is the 471 The responsibility of checking the file system is mmap safe is the
472 responsability of the caller (see `vfs.is_mmap_safe`). 472 responsibility of the caller (see `vfs.is_mmap_safe`).
473 473
474 In some case, a normal string might be returned. 474 In some case, a normal string might be returned.
475 475
476 If `pre_populate` is True (the default), the mmapped data will be 476 If `pre_populate` is True (the default), the mmapped data will be
477 pre-populated in memory if the system support this option, this slow down 477 pre-populated in memory if the system support this option, this slow down
478 the initial mmaping but avoid potentially crippling page fault on later 478 the initial mmapping but avoid potentially crippling page fault on later
479 access. If this is not the desired behavior, set `pre_populate` to False. 479 access. If this is not the desired behavior, set `pre_populate` to False.
480 """ 480 """
481 if size == 0: 481 if size == 0:
482 # size of 0 to mmap.mmap() means "all data" 482 # size of 0 to mmap.mmap() means "all data"
483 # rather than "zero bytes", so special case that. 483 # rather than "zero bytes", so special case that.