[PATCH] D90201: Try reading a smaller chunk when (p)read fails

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 10:55:15 PDT 2020


rnk added a comment.

> ... in which case llvm prefers not to mmap (as to not waste a whole page for the terminating NULL byte)

We should really re-evaluate this behavior at some point. It is quite surprising.



================
Comment at: llvm/lib/Support/Unix/Path.inc:1069
 Expected<size_t> readNativeFile(file_t FD, MutableArrayRef<char> Buf) {
+#if defined(__APPLE__)
+  size_t Size = std::min<size_t>(Buf.size(), INT32_MAX);
----------------
You know, reading maximum 2GB size chunks seems like reasonable behavior for any OS. We do it for Windows too:
https://github.com/llvm/llvm-project/blob/master/llvm/lib/Support/Windows/Path.inc#L1235

IMO we should be brave, remove the ifdef, and do 2GB reads on all OSs.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90201/new/

https://reviews.llvm.org/D90201



More information about the llvm-commits mailing list