summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorGisle Aas <gisle@activestate.com>2008-04-24 20:54:50 +0000
committerGisle Aas <gisle@activestate.com>2008-04-24 20:54:50 +0000
commit406878dddec0512d5dbd1942add8ab7e9ea12a7a (patch)
tree6fd644e4e2e222ab36434308e7532e4945ccc131 /mg.c
parent671637fed42237fcb843f592c249ac1359521292 (diff)
downloadperl-406878dddec0512d5dbd1942add8ab7e9ea12a7a.tar.gz
Inline the trivial S_raise_signal function in the perl signal handler.
This makes the code more readable and avoids the need for excuses for why the function is (still) named this way. It also effectively avoids segfaults observed with gcc-3.3 when the sibling-call optimization is used for invoking S_raise_signal() just before the signal handler returns. p4raw-id: //depot/perl@33741
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c46
1 files changed, 14 insertions, 32 deletions
diff --git a/mg.c b/mg.c
index bb89a71047..25abdce3e1 100644
--- a/mg.c
+++ b/mg.c
@@ -1329,35 +1329,6 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg)
return 0;
}
-/*
- * The signal handling nomenclature has gotten a bit confusing since the advent of
- * safe signals. S_raise_signal only raises signals by analogy with what the
- * underlying system's signal mechanism does. It might be more proper to say that
- * it defers signals that have already been raised and caught.
- *
- * PL_sig_pending and PL_psig_pend likewise do not track signals that are pending
- * in the sense of being on the system's signal queue in between raising and delivery.
- * They are only pending on Perl's deferral list, i.e., they track deferred signals
- * awaiting delivery after the current Perl opcode completes and say nothing about
- * signals raised but not yet caught in the underlying signal implementation.
- */
-
-#ifndef SIG_PENDING_DIE_COUNT
-# define SIG_PENDING_DIE_COUNT 120
-#endif
-
-static void
-S_raise_signal(pTHX_ int sig)
-{
- dVAR;
- /* Set a flag to say this signal is pending */
- PL_psig_pend[sig]++;
- /* And one to say _a_ signal is pending */
- if (++PL_sig_pending >= SIG_PENDING_DIE_COUNT)
- Perl_croak(aTHX_ "Maximal count of pending signals (%lu) exceeded",
- (unsigned long)SIG_PENDING_DIE_COUNT);
-}
-
Signal_t
#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
Perl_csighandler(int sig, siginfo_t *sip PERL_UNUSED_DECL, void *uap PERL_UNUSED_DECL)
@@ -1382,7 +1353,7 @@ Perl_csighandler(int sig)
exit(1);
#endif
#endif
- if (
+ if (
#ifdef SIGILL
sig == SIGILL ||
#endif
@@ -1400,8 +1371,19 @@ Perl_csighandler(int sig)
#else
(*PL_sighandlerp)(sig);
#endif
- else
- S_raise_signal(aTHX_ sig);
+ else {
+ /* Set a flag to say this signal is pending, that is awaiting delivery after
+ * the current Perl opcode completes */
+ PL_psig_pend[sig]++;
+
+#ifndef SIG_PENDING_DIE_COUNT
+# define SIG_PENDING_DIE_COUNT 120
+#endif
+ /* And one to say _a_ signal is pending */
+ if (++PL_sig_pending >= SIG_PENDING_DIE_COUNT)
+ Perl_croak(aTHX_ "Maximal count of pending signals (%lu) exceeded",
+ (unsigned long)SIG_PENDING_DIE_COUNT);
+ }
}
#if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS)