aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support/Process.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Support/Process.h')
-rw-r--r--include/llvm/Support/Process.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/Support/Process.h b/include/llvm/Support/Process.h
index 30973de..8616679 100644
--- a/include/llvm/Support/Process.h
+++ b/include/llvm/Support/Process.h
@@ -186,6 +186,21 @@ public:
ArrayRef<const char *> ArgsFromMain,
SpecificBumpPtrAllocator<char> &ArgAllocator);
+ // This functions ensures that the standard file descriptors (input, output,
+ // and error) are properly mapped to a file descriptor before we use any of
+ // them. This should only be called by standalone programs, library
+ // components should not call this.
+ static std::error_code FixupStandardFileDescriptors();
+
+ // This function safely closes a file descriptor. It is not safe to retry
+ // close(2) when it returns with errno equivalent to EINTR; this is because
+ // *nixen cannot agree if the file descriptor is, in fact, closed when this
+ // occurs.
+ //
+ // N.B. Some operating systems, due to thread cancellation, cannot properly
+ // guarantee that it will or will not be closed one way or the other!
+ static std::error_code SafelyCloseFileDescriptor(int FD);
+
/// This function determines if the standard input is connected directly
/// to a user's input (keyboard probably), rather than coming from a file
/// or pipe.