Usage of O_NONBLOCK in bjam is now confirmed as a bug and fixed upstream.
authorDan Gohman <gohman@apple.com>
Tue, 18 May 2010 15:25:14 +0000 (15:25 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 18 May 2010 15:25:14 +0000 (15:25 +0000)
Update the comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104021 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/raw_ostream.cpp

index 14c6a102296c42dbddbc78bf59216f7b86bc5f5a..11cf0ec4271b03701649a1b6b4012726e993ddda 100644 (file)
@@ -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