[PATCH] D56949: FileOutputBuffer: handle mmap(2) failure

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 28 10:13:19 PST 2019


sbc100 added a comment.

In D56949#1366922 <https://reviews.llvm.org/D56949#1366922>, @ruiu wrote:

> > I wonder if there are other places where this fallback is already performed at a higher level that we could presumably now remove some code?  It seems like other tools such as clang were already handling the lack of mmap since the bug reporter didn't hit an issue until link time.
>
> I don't think testing whether this fallback will be triggered or not can be done at a higher level prior to actually creating a file and call mmap(2) on the file, as the condition of the failure depends on the filesystem. Even on the same system and possibly with the same pathname, it may or may not fail, depending on the filesystem of the destination directory.


Perhaps one way to test this would be allow an implementation of `fs` (or just `mapped_file_region`) to be injected at runtime so that a unit test could run with mock fs.   That would require a bunch of refactoring to allow for such dependency injection and I'm not sure how much precedent these is in llvm for such things.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56949





More information about the llvm-commits mailing list