X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=lib%2FSupport%2FUnix%2FProcess.inc;h=2d2202557e9d7fa9e6ed898035181bc502f6dbb0;hb=69078b594c8586d40dc367b3e20237a9f3f7a1a4;hp=7a4e38614009979e23f122c9a5a24bc3c6e464ea;hpb=757e87a197dc09b1c0c30896de938ba187f4a870;p=android-x86%2Fexternal-llvm.git diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index 7a4e3861400..2d2202557e9 100644 --- a/lib/Support/Unix/Process.inc +++ b/lib/Support/Unix/Process.inc @@ -14,6 +14,7 @@ #include "Unix.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Config/config.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Mutex.h" #include "llvm/Support/MutexGuard.h" @@ -172,15 +173,6 @@ Optional Process::GetEnv(StringRef Name) { return std::string(Val); } -std::error_code -Process::GetArgumentVector(SmallVectorImpl &ArgsOut, - ArrayRef ArgsIn, - SpecificBumpPtrAllocator &) { - ArgsOut.append(ArgsIn.begin(), ArgsIn.end()); - - return std::error_code(); -} - namespace { class FDCloser { public: @@ -207,10 +199,13 @@ std::error_code Process::FixupStandardFileDescriptors() { for (int StandardFD : StandardFDs) { struct stat st; errno = 0; - if (RetryAfterSignal(-1, fstat, StandardFD, &st) < 0) { + while (fstat(StandardFD, &st) < 0) { assert(errno && "expected errno to be set if fstat failed!"); // fstat should return EBADF if the file descriptor is closed. - if (errno != EBADF) + if (errno == EBADF) + break; + // retry fstat if we got EINTR, otherwise bubble up the failure. + if (errno != EINTR) return std::error_code(errno, std::generic_category()); } // if fstat succeeds, move on to the next FD. @@ -219,8 +214,11 @@ std::error_code Process::FixupStandardFileDescriptors() { assert(errno == EBADF && "expected errno to have EBADF at this point!"); if (NullFD < 0) { - if ((NullFD = RetryAfterSignal(-1, open, "/dev/null", O_RDWR)) < 0) + while ((NullFD = open("/dev/null", O_RDWR)) < 0) { + if (errno == EINTR) + continue; return std::error_code(errno, std::generic_category()); + } } if (NullFD == StandardFD)