[llvm-commits] [llvm] r104021 - /llvm/trunk/lib/Support/raw_ostream.cpp

Dan Gohman gohman at apple.com
Tue May 18 08:25:15 PDT 2010


Author: djg
Date: Tue May 18 10:25:14 2010
New Revision: 104021

URL: http://llvm.org/viewvc/llvm-project?rev=104021&view=rev
Log:
Usage of O_NONBLOCK in bjam is now confirmed as a bug and fixed upstream.
Update the comment.

Modified:
    llvm/trunk/lib/Support/raw_ostream.cpp

Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=104021&r1=104020&r2=104021&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Tue May 18 10:25:14 2010
@@ -434,10 +434,13 @@
 
     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





More information about the llvm-commits mailing list