diff options
author | Pavel Labath <labath@google.com> | 2017-06-22 14:18:55 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-06-22 14:18:55 +0000 |
commit | efd57a8aeceda4191348c15fb95502f496ea6a00 (patch) | |
tree | 2324fee864dba7f3df2b6ece7216c9a51e05a635 /llvm/lib/Support/MemoryBuffer.cpp | |
parent | 69ffba4595590d95c2aee360f36db4742b2c606c (diff) | |
download | bcm5719-llvm-efd57a8aeceda4191348c15fb95502f496ea6a00.tar.gz bcm5719-llvm-efd57a8aeceda4191348c15fb95502f496ea6a00.zip |
Revert "[Support] Add RetryAfterSignal helper function" and subsequent fix
The fix in r306003 uncovered a pretty fundamental problem that libc++
implementation of std::result_of does not handle the prototype of
open(2) correctly (presumably because it contains ...). This makes the
whole function unusable in its current form, so I am also reverting the
original commit (r305892), which introduced the function, at least until
I figure out a way to solve the libc++ issue.
llvm-svn: 306005
Diffstat (limited to 'llvm/lib/Support/MemoryBuffer.cpp')
-rw-r--r-- | llvm/lib/Support/MemoryBuffer.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp index 85e782b2c04..227e792d83d 100644 --- a/llvm/lib/Support/MemoryBuffer.cpp +++ b/llvm/lib/Support/MemoryBuffer.cpp @@ -240,9 +240,11 @@ getMemoryBufferForStream(int FD, const Twine &BufferName) { // Read into Buffer until we hit EOF. do { Buffer.reserve(Buffer.size() + ChunkSize); - ReadBytes = sys::RetryAfterSignal(-1, read, FD, Buffer.end(), ChunkSize); - if (ReadBytes == -1) + ReadBytes = read(FD, Buffer.end(), ChunkSize); + if (ReadBytes == -1) { + if (errno == EINTR) continue; return std::error_code(errno, std::generic_category()); + } Buffer.set_size(Buffer.size() + ReadBytes); } while (ReadBytes != 0); @@ -389,12 +391,13 @@ getOpenFileImpl(int FD, const Twine &Filename, uint64_t FileSize, while (BytesLeft) { #ifdef HAVE_PREAD - ssize_t NumRead = sys::RetryAfterSignal(-1, ::pread, FD, BufPtr, BytesLeft, - MapSize - BytesLeft + Offset); + ssize_t NumRead = ::pread(FD, BufPtr, BytesLeft, MapSize-BytesLeft+Offset); #else - ssize_t NumRead = sys::RetryAfterSignal(-1, ::read, FD, BufPtr, BytesLeft); + ssize_t NumRead = ::read(FD, BufPtr, BytesLeft); #endif if (NumRead == -1) { + if (errno == EINTR) + continue; // Error while reading. return std::error_code(errno, std::generic_category()); } |