[PATCH] D46618: [sanitizer] Cleanup ReadFileToVector and ReadFileToBuffer
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 5 11:31:41 PDT 2018
vitalybuka added inline comments.
================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_common.h:647
+// This function is less I/O efficient than ReadFileToVector as it
+// may reread file multiple times to avoid avoid mmap during read
+// attempts.
----------------
morehouse wrote:
> Why is it implemented this way rather than copying over the bytes that have already been read?
Updated comment.
================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_file.cc:97
bool ReadFileToBuffer(const char *file_name, char **buff, uptr *buff_size,
uptr *read_len, uptr max_len, error_t *errno_p) {
*buff = nullptr;
----------------
morehouse wrote:
> This function looks much better than before, but since we're already modifying this maybe it would make sense to copy data over to the new mmapped region rather than rereading it.
we can't as we want to discard results after each short read for proc maps
Repository:
rL LLVM
https://reviews.llvm.org/D46618
More information about the llvm-commits
mailing list