Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106963234
D42984.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D42984.diff
View Options
diff --git a/contrib/llvm-project/llvm/lib/Support/Unix/Process.inc b/contrib/llvm-project/llvm/lib/Support/Unix/Process.inc
--- a/contrib/llvm-project/llvm/lib/Support/Unix/Process.inc
+++ b/contrib/llvm-project/llvm/lib/Support/Unix/Process.inc
@@ -235,6 +235,25 @@
return std::error_code();
}
+// Close a file descriptor while being mindful of EINTR.
+//
+// On Unix systems closing a file descriptor usually starts with removing it
+// from the fd table (or an equivalent structure). This means any error
+// generated past that point will still result in the entry being cleared.
+//
+// Make sure to not bubble up EINTR as there is nothing to do in that case.
+// XXX what about other errors?
+#if defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__) || \
+ defined(__NetBSD__) || defined(__OpenBSD__)
+std::error_code Process::SafelyCloseFileDescriptor(int FD) {
+ int EC = 0;
+ if (::close(FD) < 0) {
+ if (errno != EINTR)
+ EC = errno;
+ }
+ return std::error_code(EC, std::generic_category());
+}
+#else
std::error_code Process::SafelyCloseFileDescriptor(int FD) {
// Create a signal set filled with *all* signals.
sigset_t FullSet, SavedSet;
@@ -269,6 +288,7 @@
return std::error_code(ErrnoFromClose, std::generic_category());
return std::error_code(EC, std::generic_category());
}
+#endif
bool Process::StandardInIsUserInput() {
return FileDescriptorIsDisplayed(STDIN_FILENO);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 9, 4:08 AM (1 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15729300
Default Alt Text
D42984.diff (1 KB)
Attached To
Mode
D42984: llvm: Support: don't block signals around close if it can be avoided
Attached
Detach File
Event Timeline
Log In to Comment