summaryrefslogtreecommitdiff
path: root/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-18 15:25:14 +0000
committerDan Gohman <gohman@apple.com>2010-05-18 15:25:14 +0000
commit68e947ac61dd6f3404ea3fbc3b5f0c539c694a06 (patch)
treec0ed9eec34c4bf6ca8f8956129a743f48e31ece4 /lib/Support/raw_ostream.cpp
parent47f9a49560cbf629ff36f3efb591d70b29471320 (diff)
downloadllvm-68e947ac61dd6f3404ea3fbc3b5f0c539c694a06.tar.gz
llvm-68e947ac61dd6f3404ea3fbc3b5f0c539c694a06.tar.bz2
llvm-68e947ac61dd6f3404ea3fbc3b5f0c539c694a06.tar.xz
Usage of O_NONBLOCK in bjam is now confirmed as a bug and fixed upstream.
Update the comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104021 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-rw-r--r--lib/Support/raw_ostream.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index 14c6a10229..11cf0ec427 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -434,10 +434,13 @@ void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) {
if (ret < 0) {
// If it's a recoverable error, swallow it and retry the write.
- // EAGAIN and EWOULDBLOCK are not unambiguously recoverable, but
- // some programs, such as bjam, assume that their child processes
- // will treat them as if they are. If you don't want this code to
- // spin, don't use O_NONBLOCK file descriptors with raw_ostream.
+ //
+ // Ideally we wouldn't ever see EAGAIN or EWOULDBLOCK here, since
+ // raw_ostream isn't designed to do non-blocking I/O. However, some
+ // programs, such as old versions of bjam, have mistakenly used
+ // O_NONBLOCK. For compatibility, emulate blocking semantics by
+ // spinning until the write succeeds. If you don't want spinning,
+ // don't use O_NONBLOCK file descriptors with raw_ostream.
if (errno == EINTR || errno == EAGAIN
#ifdef EWOULDBLOCK
|| errno == EWOULDBLOCK