diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-14 17:40:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-14 17:40:56 +0000 |
commit | 82f631ac5740af938ccb3ee5f05f3463e0e44854 (patch) | |
tree | e6c11f828b367e3d8c64e246fdaccf23b4f7dcb1 /signal.c | |
parent | 67d0ce36f5c9405434a5a97230ca3593dbe86974 (diff) |
* 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/trunk@15476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'signal.c')
-rw-r--r-- | signal.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -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 @@ -629,7 +635,7 @@ rb_trap_exec(void) } struct trap_arg { -#ifndef _WIN32 +#if USE_TRAP_MASK # ifdef HAVE_SIGPROCMASK sigset_t mask; # else @@ -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 @@ -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) { @@ -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 @@ -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); @@ -955,7 +961,7 @@ static void init_sigchld(int sig) { sighandler_t oldfunc; -#ifndef _WIN32 +#if USE_TRAP_MASK # ifdef HAVE_SIGPROCMASK sigset_t mask; # else @@ -963,7 +969,7 @@ init_sigchld(int sig) # endif #endif -#ifndef _WIN32 +#if USE_TRAP_MASK /* disable interrupt */ # ifdef HAVE_SIGPROCMASK sigfillset(&mask); @@ -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); |