diff options
author | Timur Iskhodzhanov <timurrrr@google.com> | 2015-04-09 14:45:17 +0000 |
---|---|---|
committer | Timur Iskhodzhanov <timurrrr@google.com> | 2015-04-09 14:45:17 +0000 |
commit | a6600a974a7bf8b5b7afab68632322806b51d051 (patch) | |
tree | 10c44a6e5400043c8e06326bda117e945d886c87 | |
parent | 6759d124e77baa591061a2ef688d8ba6ce6ba557 (diff) | |
download | bcm5719-llvm-a6600a974a7bf8b5b7afab68632322806b51d051.tar.gz bcm5719-llvm-a6600a974a7bf8b5b7afab68632322806b51d051.zip |
Use RenameFile instead of internal_rename in non-POSIX code
llvm-svn: 234490
6 files changed, 14 insertions, 7 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.h b/compiler-rt/lib/sanitizer_common/sanitizer_common.h index 85f0dd68ad2..5a7455ee287 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -207,6 +207,9 @@ bool ReadFromFile(fd_t fd, void *buff, uptr buff_size, bool WriteToFile(fd_t fd, const void *buff, uptr buff_size, uptr *bytes_written = nullptr, error_t *error_p = nullptr); +bool RenameFile(const char *oldpath, const char *newpath, + error_t *error_p = nullptr); + bool SupportsColoredOutput(fd_t fd); // Opens the file 'file_name" and reads up to 'max_len' bytes. diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc index bed9614dce3..ad7db2389ae 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc @@ -118,8 +118,7 @@ void CovUpdateMapping(const char *coverage_dir, uptr caller_pc) { res = internal_snprintf((char *)path.data(), path.size(), "%s/%zd.sancov.map", coverage_dir, internal_getpid()); CHECK_LE(res, path.size()); - res = internal_rename(tmp_path.data(), path.data()); - if (internal_iserror(res, &err)) { + if (!RenameFile(tmp_path.data(), path.data(), &err)) { Printf("sancov.map rename failed: %d\n", err); Die(); } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_libc.h b/compiler-rt/lib/sanitizer_common/sanitizer_libc.h index 84bcfa49451..b8cad2446a4 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_libc.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_libc.h @@ -66,7 +66,6 @@ const fd_t kStderrFd = 2; uptr internal_ftruncate(fd_t fd, uptr size); // OS -uptr internal_rename(const char *oldpath, const char *newpath); void NORETURN internal__exit(int exitcode); uptr internal_getpid(); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc index 1b0f25a88f1..f3ae613de5c 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc @@ -243,6 +243,11 @@ bool WriteToFile(fd_t fd, const void *buff, uptr buff_size, uptr *bytes_written, return true; } +bool RenameFile(const char *oldpath, const char *newpath, error_t *error_p) { + uptr res = internal_rename(oldpath, newpath); + return !internal_iserror(res, error_p); +} + void *MapFileToMemory(const char *file_name, uptr *buff_size) { fd_t fd = OpenFile(file_name, RdOnly); CHECK(fd != kInvalidFd); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_posix.h index de01bce5bc0..bb1eb354c44 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_posix.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix.h @@ -46,6 +46,7 @@ uptr internal_fstat(fd_t fd, void *buf); uptr internal_dup2(int oldfd, int newfd); uptr internal_readlink(const char *path, char *buf, uptr bufsize); uptr internal_unlink(const char *path); +uptr internal_rename(const char *oldpath, const char *newpath); uptr internal_lseek(fd_t fd, OFF_T offset, int whence); uptr internal_ptrace(int request, int pid, void *addr, void *data); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc index c2bae09972a..96eb249dd31 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cc @@ -469,6 +469,10 @@ bool WriteToFile(fd_t fd, const void *buff, uptr buff_size, uptr *bytes_written, return false; } +bool RenameFile(const char *oldpath, const char *newpath, error_t *error_p) { + UNIMPLEMENTED(); +} + uptr internal_sched_yield() { Sleep(0); return 0; @@ -482,10 +486,6 @@ uptr internal_ftruncate(fd_t fd, uptr size) { UNIMPLEMENTED(); } -uptr internal_rename(const char *oldpath, const char *newpath) { - UNIMPLEMENTED(); -} - uptr GetRSS() { return 0; } |