mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* signal.c (register_sigaltstack): should not add external
variable (with some cosmetic changes). [ruby-dev:37158] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bf1d53e2e0
commit
3380a05bd6
2 changed files with 15 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Nov 24 23:16:32 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* signal.c (register_sigaltstack): should not add external
|
||||
variable (with some cosmetic changes). [ruby-dev:37158]
|
||||
|
||||
Mon Nov 24 22:57:25 2008 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* strftime.c (rb_strftime): A width specifier for %t and %n should
|
||||
|
|
18
signal.c
18
signal.c
|
@ -47,11 +47,6 @@ typedef int rb_atomic_t;
|
|||
# define NSIG (_SIGMAX + 1) /* For QNX */
|
||||
#endif
|
||||
|
||||
#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK)
|
||||
#define USE_SIGALTSTACK
|
||||
int is_altstack_defined = 0;
|
||||
#endif
|
||||
|
||||
static const struct signals {
|
||||
const char *signm;
|
||||
int signo;
|
||||
|
@ -415,6 +410,10 @@ static struct {
|
|||
typedef RETSIGTYPE (*sighandler_t)(int);
|
||||
|
||||
#ifdef POSIX_SIGNAL
|
||||
#if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK)
|
||||
#define USE_SIGALTSTACK
|
||||
#endif
|
||||
|
||||
#ifdef USE_SIGALTSTACK
|
||||
#ifdef SIGSTKSZ
|
||||
#define ALT_STACK_SIZE SIGSTKSZ
|
||||
|
@ -422,14 +421,17 @@ typedef RETSIGTYPE (*sighandler_t)(int);
|
|||
#define ALT_STACK_SIZE (4*1024)
|
||||
#endif
|
||||
/* alternate stack for SIGSEGV */
|
||||
static void register_sigaltstack() {
|
||||
static void
|
||||
register_sigaltstack()
|
||||
{
|
||||
static int is_altstack_defined = 0;
|
||||
stack_t newSS, oldSS;
|
||||
|
||||
if(is_altstack_defined)
|
||||
if (is_altstack_defined)
|
||||
return;
|
||||
|
||||
newSS.ss_sp = malloc(ALT_STACK_SIZE);
|
||||
if(newSS.ss_sp == NULL)
|
||||
if (newSS.ss_sp == NULL)
|
||||
/* should handle error */
|
||||
rb_bug("register_sigaltstack. malloc error\n");
|
||||
newSS.ss_size = ALT_STACK_SIZE;
|
||||
|
|
Loading…
Reference in a new issue