ART: Host timeout Mac build fix.
Mac fix for unsupported SIGRTMIN introduced in commit
038bb2252ed1d7132f45006507e389b7ba1617ce.
Bug: 18933933
Change-Id: I502cda51802d67f089c09240d89f71166ed56c6d
diff --git a/runtime/runtime_linux.cc b/runtime/runtime_linux.cc
index a0adcd1..55dfb0f 100644
--- a/runtime/runtime_linux.cc
+++ b/runtime/runtime_linux.cc
@@ -34,6 +34,7 @@
namespace art {
static constexpr bool kDumpHeapObjectOnSigsevg = false;
+static constexpr bool kUseSigRTTimeout = true;
struct Backtrace {
public:
@@ -284,8 +285,14 @@
mcontext_t& context;
};
+// Return the signal number we recognize as timeout. -1 means not active/supported.
static int GetTimeoutSignal() {
- return SIGRTMIN + 2;
+#if defined(__APPLE__)
+ // Mac does not support realtime signals.
+ return -1;
+#else
+ return kUseSigRTTimeout ? (SIGRTMIN + 2) : -1;
+#endif
}
static bool IsTimeoutSignal(int signal_number) {
@@ -392,7 +399,9 @@
#endif
rc += sigaction(SIGTRAP, &action, NULL);
// Special dump-all timeout.
- rc += sigaction(GetTimeoutSignal(), &action, NULL);
+ if (GetTimeoutSignal() != -1) {
+ rc += sigaction(GetTimeoutSignal(), &action, NULL);
+ }
CHECK_EQ(rc, 0);
}