mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306005 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user