summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-09 13:02:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-09 13:02:13 +0000
commita4d8a6e1489dd14e4fb83ea2181efec92935fec5 (patch)
treef223a5829dce50b7708bd19078c93717d98b35df
parent9f4db3bcdbfc485fc49a934d0f1652542e27b7ec (diff)
signal.c: no sigsegv handler with valgrind
* signal.c: disable handling signals to dump core, if installing unreserved signals failed, not valgrind to hang on Mac OS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--signal.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/signal.c b/signal.c
index a3e05e4..25c3e86 100644
--- a/signal.c
+++ b/signal.c
@@ -1386,10 +1386,13 @@ sig_list(void)
return h;
}
-#define install_sighandler_fail(signame, signum) \
- (reserved_signal_p(signum) ? \
- rb_bug("failed to install "signame" handler") : \
- perror("failed to install "signame" handler"))
+#define INSTALL_SIGHANDLER(cond, signame, signum) do { \
+ static const char failed[] = "failed to install "signame" handler"; \
+ if (!(cond)) break; \
+ if (reserved_signal_p(signum)) rb_bug(failed); \
+ ruby_enable_coredump = 1; \
+ perror(failed); \
+ } while (0)
static int
install_sighandler(int signum, sighandler_t handler)
{
@@ -1405,8 +1408,7 @@ install_sighandler(int signum, sighandler_t handler)
}
#ifndef __native_client__
# define install_sighandler(signum, handler) \
- (install_sighandler(signum, handler) ? \
- install_sighandler_fail(#signum, signum) : (void)0)
+ INSTALL_SIGHANDLER(install_sighandler(signum, handler), #signum, signum)
#endif
#if defined(SIGCLD) || defined(SIGCHLD)
@@ -1427,7 +1429,7 @@ init_sigchld(int sig)
}
# ifndef __native_client__
# define init_sigchld(signum) \
- (init_sigchld(signum) ? install_sighandler_fail(#signum, signum) : (void)0)
+ INSTALL_SIGHANDLER(init_sigchld(signum), #signum, signum)
# endif
#endif