summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
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
commitdea53104339d960bc8569388a8d5eae6a4214d8c (patch)
tree5248405ff7498c36bbeb084a9ca5f6381632bf74 /llvm/lib/Support
parentab7be75e3f8fafca83da6556b55ea07e6f4ae7a7 (diff)
downloadbcm5719-llvm-dea53104339d960bc8569388a8d5eae6a4214d8c.tar.gz
bcm5719-llvm-dea53104339d960bc8569388a8d5eae6a4214d8c.zip
Usage of O_NONBLOCK in bjam is now confirmed as a bug and fixed upstream.
Update the comment. llvm-svn: 104021
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/raw_ostream.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 14c6a102296..11cf0ec4271 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud