1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Share the size for sigaltstack between configure.ac and signal.c

This commit is contained in:
Nobuyoshi Nakada 2020-07-22 21:26:21 +09:00
parent 8b0dc77a62
commit 50aac2ffd5
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 7 additions and 4 deletions

View file

@ -2929,6 +2929,7 @@ AS_IF([test "x$ac_cv_func_backtrace" = xyes], [
#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)
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");

View file

@ -524,11 +524,13 @@ typedef RETSIGTYPE ruby_sigaction_t(int);
#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
{