ruby-changes:46937
From: nobu <ko1@a...>
Date: Fri, 9 Jun 2017 22:02:19 +0900 (JST)
Subject: [ruby-changes:46937] nobu:r59052 (trunk): signal.c: no sigsegv handler with valgrind
nobu 2017-06-09 22:02:13 +0900 (Fri, 09 Jun 2017) New Revision: 59052 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59052 Log: 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. Modified files: trunk/signal.c Index: signal.c =================================================================== --- signal.c (revision 59051) +++ signal.c (revision 59052) @@ -1386,10 +1386,13 @@ sig_list(void) https://github.com/ruby/ruby/blob/trunk/signal.c#L1386 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, sighandle https://github.com/ruby/ruby/blob/trunk/signal.c#L1408 } #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) https://github.com/ruby/ruby/blob/trunk/signal.c#L1429 } # 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/