зеркало из https://github.com/github/ruby.git
Share the size for sigaltstack between configure.ac and signal.c
This commit is contained in:
Родитель
8b0dc77a62
Коммит
50aac2ffd5
|
@ -2929,6 +2929,7 @@ AS_IF([test "x$ac_cv_func_backtrace" = xyes], [
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
|
|
||||||
|
]`grep '^@%:@ *define *RUBY_SIGALTSTACK_SIZE' ${srcdir}/signal.c`[
|
||||||
#define TRACE_SIZE 256
|
#define TRACE_SIZE 256
|
||||||
|
|
||||||
void sigsegv(int signum, siginfo_t *info, void *ctx){
|
void sigsegv(int signum, siginfo_t *info, void *ctx){
|
||||||
|
@ -2948,12 +2949,12 @@ main(void)
|
||||||
stack_t ss;
|
stack_t ss;
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
ss.ss_sp = malloc(16*1024);
|
ss.ss_sp = malloc(RUBY_SIGALTSTACK_SIZE);
|
||||||
if (ss.ss_sp == NULL) {
|
if (ss.ss_sp == NULL) {
|
||||||
fprintf(stderr, "cannot allocate memory for sigaltstack\n");
|
fprintf(stderr, "cannot allocate memory for sigaltstack\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
ss.ss_size = 16*1024;
|
ss.ss_size = RUBY_SIGALTSTACK_SIZE;
|
||||||
ss.ss_flags = 0;
|
ss.ss_flags = 0;
|
||||||
if (sigaltstack(&ss, NULL) == -1) {
|
if (sigaltstack(&ss, NULL) == -1) {
|
||||||
fprintf(stderr, "sigaltstack failed\n");
|
fprintf(stderr, "sigaltstack failed\n");
|
||||||
|
|
6
signal.c
6
signal.c
|
@ -524,11 +524,13 @@ typedef RETSIGTYPE ruby_sigaction_t(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SIGALTSTACK
|
#ifdef USE_SIGALTSTACK
|
||||||
|
/* XXX: BSD_vfprintf() uses >1500B stack and x86-64 need >5KiB stack. */
|
||||||
|
#define RUBY_SIGALTSTACK_SIZE (16*1024)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rb_sigaltstack_size(void)
|
rb_sigaltstack_size(void)
|
||||||
{
|
{
|
||||||
/* XXX: BSD_vfprintf() uses >1500B stack and x86-64 need >5KiB stack. */
|
int size = RUBY_SIGALTSTACK_SIZE;
|
||||||
int size = 16*1024;
|
|
||||||
|
|
||||||
#ifdef MINSIGSTKSZ
|
#ifdef MINSIGSTKSZ
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче