Skip to content

Commit

Permalink
* configure.in (sigsetmask): check when signal semantics is not POSIX.
Browse files Browse the repository at this point in the history
* signal.c (USE_TRAP_MASK): set true if sigprocmask or sigsetmask is
  available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Feb 14, 2008
1 parent 67d0ce3 commit 82f631a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Fri Feb 15 02:40:54 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>

* configure.in (sigsetmask): check when signal semantics is not POSIX.

* signal.c (USE_TRAP_MASK): set true if sigprocmask or sigsetmask is
available.

Thu Feb 14 23:56:38 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>

* eval_error.c (error_print): append a newline to rest lines.
Expand Down
3 changes: 2 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ fi
if test "$ac_cv_func_sigprocmask" = yes && test "$ac_cv_func_sigaction" = yes; then
AC_DEFINE(POSIX_SIGNAL)
else
AC_CHECK_FUNCS(sigsetmask)
AC_CACHE_CHECK(for BSD signal semantics, rb_cv_bsd_signal,
[AC_TRY_RUN([
#include <stdio.h>
Expand All @@ -792,7 +793,7 @@ main()
],
rb_cv_bsd_signal=yes,
rb_cv_bsd_signal=no,
rb_cv_bsd_signal=no)])
rb_cv_bsd_signal=$ac_cv_func_sigsetmask)])
if test "$rb_cv_bsd_signal" = yes; then
AC_DEFINE(BSD_SIGNAL)
fi
Expand Down
22 changes: 14 additions & 8 deletions signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
#undef SIGBUS
#endif

#if defined HAVE_SIGPROCMASK || defined HAVE_SIGSETMASK
#define USE_TRAP_MASK 1
#else
#define USE_TRAP_MASK 0
#endif

#ifndef NSIG
# ifdef DJGPP
# define NSIG SIGMAX
Expand Down Expand Up @@ -629,7 +635,7 @@ rb_trap_exec(void)
}

struct trap_arg {
#ifndef _WIN32
#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
sigset_t mask;
# else
Expand Down Expand Up @@ -813,7 +819,7 @@ trap(struct trap_arg *arg)

trap_list[sig].cmd = command;
/* enable at least specified signal. */
#ifndef _WIN32
#if USE_TRAP_MASK
#ifdef HAVE_SIGPROCMASK
sigdelset(&arg->mask, sig);
#else
Expand All @@ -823,7 +829,7 @@ trap(struct trap_arg *arg)
return oldcmd;
}

#ifndef _WIN32
#if USE_TRAP_MASK
static VALUE
trap_ensure(struct trap_arg *arg)
{
Expand All @@ -841,7 +847,7 @@ trap_ensure(struct trap_arg *arg)
void
rb_trap_restore_mask(void)
{
#ifndef _WIN32
#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
sigprocmask(SIG_SETMASK, &trap_last_mask, NULL);
# else
Expand Down Expand Up @@ -904,7 +910,7 @@ sig_trap(int argc, VALUE *argv)
if (OBJ_TAINTED(arg.cmd)) {
rb_raise(rb_eSecurityError, "Insecure: tainted signal trap");
}
#ifndef _WIN32
#if USE_TRAP_MASK
/* disable interrupt */
# ifdef HAVE_SIGPROCMASK
sigfillset(&arg.mask);
Expand Down Expand Up @@ -955,15 +961,15 @@ static void
init_sigchld(int sig)
{
sighandler_t oldfunc;
#ifndef _WIN32
#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
sigset_t mask;
# else
int mask;
# endif
#endif

#ifndef _WIN32
#if USE_TRAP_MASK
/* disable interrupt */
# ifdef HAVE_SIGPROCMASK
sigfillset(&mask);
Expand All @@ -980,7 +986,7 @@ init_sigchld(int sig)
trap_list[sig].cmd = 0;
}

#ifndef _WIN32
#if USE_TRAP_MASK
#ifdef HAVE_SIGPROCMASK
sigdelset(&mask, sig);
sigprocmask(SIG_SETMASK, &mask, NULL);
Expand Down
6 changes: 3 additions & 3 deletions version.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2008-02-14"
#define RUBY_RELEASE_DATE "2008-02-15"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20080214
#define RUBY_RELEASE_CODE 20080215
#define RUBY_PATCHLEVEL 0

#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 2
#define RUBY_RELEASE_DAY 14
#define RUBY_RELEASE_DAY 15

#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];
Expand Down

0 comments on commit 82f631a

Please sign in to comment.