diff options
author | Kenneth Heafield <kheafiel@cluster12.lti.ece.cmu.local> | 2011-05-20 16:19:04 -0400 |
---|---|---|
committer | Kenneth Heafield <kheafiel@cluster12.lti.ece.cmu.local> | 2011-05-20 16:19:04 -0400 |
commit | 461c2670efb0968ccc6789ff0c9ca6f88ab31e80 (patch) | |
tree | 6b344dcf320674213fd449e6a4915236ad78c29f /klm/util/file_piece.cc | |
parent | 0e7b303879baf95a8167194ad7c75ef738e79f15 (diff) |
kenlm update including being nicer to NFS
Diffstat (limited to 'klm/util/file_piece.cc')
-rw-r--r-- | klm/util/file_piece.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/klm/util/file_piece.cc b/klm/util/file_piece.cc index 67681f7e..f447a70c 100644 --- a/klm/util/file_piece.cc +++ b/klm/util/file_piece.cc @@ -237,7 +237,12 @@ void FilePiece::MMapShift(off_t desired_begin) throw() { // Forcibly clear the existing mmap first. data_.reset(); - data_.reset(mmap(NULL, mapped_size, PROT_READ, MAP_PRIVATE, *file_, mapped_offset), mapped_size, scoped_memory::MMAP_ALLOCATED); + data_.reset(mmap(NULL, mapped_size, PROT_READ, MAP_SHARED + // Populate where available on linux +#ifdef MAP_POPULATE + | MAP_POPULATE +#endif + , *file_, mapped_offset), mapped_size, scoped_memory::MMAP_ALLOCATED); if (data_.get() == MAP_FAILED) { if (desired_begin) { if (((off_t)-1) == lseek(*file_, desired_begin, SEEK_SET)) UTIL_THROW(ErrnoException, "mmap failed even though it worked before. lseek failed too, so using read isn't an option either."); |