summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
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 82400e7addb..530bcc1164a 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
@@ -570,7 +576,7 @@ rb_trap_exec()
}
struct trap_arg {
-#ifndef _WIN32
+#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
sigset_t mask;
# else
@@ -716,7 +722,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
@@ -726,7 +732,7 @@ trap(arg)
return oldcmd;
}
-#ifndef _WIN32
+#if USE_TRAP_MASK
static VALUE
trap_ensure(arg)
struct trap_arg *arg;
@@ -745,7 +751,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
@@ -805,7 +811,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);
@@ -888,7 +894,7 @@ init_sigchld(sig)
int sig;
{
sighandler_t oldfunc;
-#ifndef _WIN32
+#if USE_TRAP_MASK
# ifdef HAVE_SIGPROCMASK
sigset_t mask;
# else
@@ -896,7 +902,7 @@ init_sigchld(sig)
# endif
#endif
-#ifndef _WIN32
+#if USE_TRAP_MASK
/* disable interrupt */
# ifdef HAVE_SIGPROCMASK
sigfillset(&mask);
@@ -913,7 +919,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);