lib/fs: do not use mmap for 32-bit arches by default, since they cannot map files bigger than 4GB in RAM

This commit is contained in:
Aliaksandr Valialkin 2020-05-12 20:18:57 +03:00
parent 81b8811cf4
commit c9ab6dc532

View file

@ -10,7 +10,10 @@ import (
"golang.org/x/sys/unix"
)
var disableMmap = flag.Bool("fs.disableMmap", false, "Whether to use pread() instead of mmap() for reading data files")
var disableMmap = flag.Bool("fs.disableMmap", is32BitPtr, "Whether to use pread() instead of mmap() for reading data files. "+
"By default mmap() is used for 64-bit arches and pread() is used for 32-bit arches, since they cannot data files bigger than 2^32 bytes in memory")
const is32BitPtr = (^uintptr(0) >> 32) == 0
// MustReadAtCloser is rand-access read interface.
type MustReadAtCloser interface {