Skip to content

Commit

Permalink
merges r20341 from trunk into ruby_1_9_1.
Browse files Browse the repository at this point in the history
* signal.c (register_sigaltstack): should not add external
  variable (with some cosmetic changes).  [ruby-dev:37158]

git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
yugui committed Nov 30, 2008
1 parent 501592c commit 2b02027
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -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
Expand Down
18 changes: 10 additions & 8 deletions signal.c
Expand Up @@ -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;
Expand Down Expand Up @@ -415,21 +410,28 @@ 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
#else
#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;
Expand Down

0 comments on commit 2b02027

Please sign in to comment.