summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 10:05:11 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-15 10:05:11 +0000
commitb862aa9e4abcf5a9fdcc97d5809085d46e05cc39 (patch)
tree3c2fd508d49de0465edf9725b32deea7c5428bce /signal.c
parentc6c5a44bcb81ddc72f31a57ee379ec66ce3f9bf9 (diff)
merge revision(s) 15476:
* configure.in (sigsetmask): check when signal semantics is not POSIX. * signal.c (USE_TRAP_MASK): set true if sigprocmask or sigsetmask is available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@17169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/signal.c b/signal.c
index 0f1171b..115ee99 100644
--- a/signal.c
+++ b/signal.c
@@ -21,6 +21,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
@@ -663,7 +669,7 @@ rb_trap_exec()
}
struct trap_arg {
-#ifndef _WIN32
+#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
sigset_t mask;
# else
@@ -812,7 +818,7 @@ trap(arg)
trap_list[sig].cmd = command;
trap_list[sig].safe = ruby_safe_level;
/* enable at least specified signal. */
-#ifndef _WIN32
+#if USE_TRAP_MASK
#ifdef HAVE_SIGPROCMASK
sigdelset(&arg->mask, sig);
#else
@@ -822,7 +828,7 @@ trap(arg)
return oldcmd;
}
-#ifndef _WIN32
+#if USE_TRAP_MASK
static VALUE
trap_ensure(arg)
struct trap_arg *arg;
@@ -841,7 +847,7 @@ trap_ensure(arg)
void
rb_trap_restore_mask()
{
-#ifndef _WIN32
+#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
sigprocmask(SIG_SETMASK, &trap_last_mask, NULL);
# else
@@ -901,7 +907,7 @@ sig_trap(argc, 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);
@@ -984,7 +990,7 @@ init_sigchld(sig)
int sig;
{
sighandler_t oldfunc;
-#ifndef _WIN32
+#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
sigset_t mask;
# else
@@ -992,7 +998,7 @@ init_sigchld(sig)
# endif
#endif
-#ifndef _WIN32
+#if USE_TRAP_MASK
/* disable interrupt */
# ifdef HAVE_SIGPROCMASK
sigfillset(&mask);
@@ -1009,7 +1015,7 @@ init_sigchld(sig)
trap_list[sig].cmd = 0;
}
-#ifndef _WIN32
+#if USE_TRAP_MASK
#ifdef HAVE_SIGPROCMASK
sigdelset(&mask, sig);
sigprocmask(SIG_SETMASK, &mask, NULL);