ruby-changes:62357
From: Nobuyoshi <ko1@a...>
Date: Wed, 22 Jul 2020 21:34:40 +0900 (JST)
Subject: [ruby-changes:62357] 50aac2ffd5 (master): Share the size for sigaltstack between configure.ac and signal.c
https://git.ruby-lang.org/ruby.git/commit/?id=50aac2ffd5 From 50aac2ffd59c7b0d871a82c23048846ad2f3f38b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 22 Jul 2020 21:26:21 +0900 Subject: Share the size for sigaltstack between configure.ac and signal.c diff --git a/configure.ac b/configure.ac index ae908f7..2fd4c7c 100644 --- a/configure.ac +++ b/configure.ac @@ -2929,6 +2929,7 @@ AS_IF([test "x$ac_cv_func_backtrace" = xyes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L2929 #include <signal.h> #include <execinfo.h> +]`grep '^@%:@ *define *RUBY_SIGALTSTACK_SIZE' ${srcdir}/signal.c`[ #define TRACE_SIZE 256 void sigsegv(int signum, siginfo_t *info, void *ctx){ @@ -2948,12 +2949,12 @@ main(void) https://github.com/ruby/ruby/blob/trunk/configure.ac#L2949 stack_t ss; struct sigaction sa; - ss.ss_sp = malloc(16*1024); + ss.ss_sp = malloc(RUBY_SIGALTSTACK_SIZE); if (ss.ss_sp == NULL) { fprintf(stderr, "cannot allocate memory for sigaltstack\n"); return EXIT_FAILURE; } - ss.ss_size = 16*1024; + ss.ss_size = RUBY_SIGALTSTACK_SIZE; ss.ss_flags = 0; if (sigaltstack(&ss, NULL) == -1) { fprintf(stderr, "sigaltstack failed\n"); diff --git a/signal.c b/signal.c index 7f8687e..615ceb7 100644 --- a/signal.c +++ b/signal.c @@ -524,11 +524,13 @@ typedef RETSIGTYPE ruby_sigaction_t(int); https://github.com/ruby/ruby/blob/trunk/signal.c#L524 #endif #ifdef USE_SIGALTSTACK +/* XXX: BSD_vfprintf() uses >1500B stack and x86-64 need >5KiB stack. */ +#define RUBY_SIGALTSTACK_SIZE (16*1024) + static int rb_sigaltstack_size(void) { - /* XXX: BSD_vfprintf() uses >1500B stack and x86-64 need >5KiB stack. */ - int size = 16*1024; + int size = RUBY_SIGALTSTACK_SIZE; #ifdef MINSIGSTKSZ { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/