diff options
Diffstat (limited to 'compiler-rt/lib/asan')
| -rw-r--r-- | compiler-rt/lib/asan/asan_internal.h | 7 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/asan_rtl.cc | 31 |
2 files changed, 0 insertions, 38 deletions
diff --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h index c832d30023d..9dad2130919 100644 --- a/compiler-rt/lib/asan/asan_internal.h +++ b/compiler-rt/lib/asan/asan_internal.h @@ -146,13 +146,6 @@ void AsanTSDInit(void (*destructor)(void *tsd)); void *AsanTSDGet(); void AsanTSDSet(void *tsd); -// Opens the file 'file_name" and reads up to 'max_len' bytes. -// The resulting buffer is mmaped and stored in '*buff'. -// The size of the mmaped region is stored in '*buff_size', -// Returns the number of read bytes or 0 if file can not be opened. -uptr ReadFileToBuffer(const char *file_name, char **buff, - uptr *buff_size, uptr max_len); - void AppendToErrorMessageBuffer(const char *buffer); // asan_printf.cc void AsanPrintf(const char *format, ...); diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc index df5c1fe3650..96078ebd3fd 100644 --- a/compiler-rt/lib/asan/asan_rtl.cc +++ b/compiler-rt/lib/asan/asan_rtl.cc @@ -109,37 +109,6 @@ static void PrintBytes(const char *before, uptr *a) { AsanPrintf("\n"); } -uptr ReadFileToBuffer(const char *file_name, char **buff, - uptr *buff_size, uptr max_len) { - const uptr kMinFileLen = kPageSize; - uptr read_len = 0; - *buff = 0; - *buff_size = 0; - // The files we usually open are not seekable, so try different buffer sizes. - for (uptr size = kMinFileLen; size <= max_len; size *= 2) { - fd_t fd = internal_open(file_name, /*write*/ false); - if (fd < 0) return 0; - UnmapOrDie(*buff, *buff_size); - *buff = (char*)MmapOrDie(size, __FUNCTION__); - *buff_size = size; - // Read up to one page at a time. - read_len = 0; - bool reached_eof = false; - while (read_len + kPageSize <= size) { - uptr just_read = internal_read(fd, *buff + read_len, kPageSize); - if (just_read == 0) { - reached_eof = true; - break; - } - read_len += just_read; - } - internal_close(fd); - if (reached_eof) // We've read the whole file. - break; - } - return read_len; -} - void AppendToErrorMessageBuffer(const char *buffer) { if (error_message_buffer) { uptr length = (uptr)internal_strlen(buffer); |

