summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-01-11 20:57:44 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-01-11 20:57:44 +0000
commit1b266415f383a85c93346bb15a7bdcac7f62eb77 (patch)
tree0b4195c790a9a539f53fff4d87708a91de9c5e1d /mg.c
parent4bfee161f7a97900585aa2d88dc2e41ec655cbfb (diff)
downloadperl-1b266415f383a85c93346bb15a7bdcac7f62eb77.tar.gz
Catch die in %SIG handler and unblock the signal before re-dying.
This make Linux work _without_ sigsetjmp(). Turn off sigsetjmp() to see what else it does. May need Configure probe for sigprocmask() if anything has sigaction() but not sigprocmask(). p4raw-id: //depot/perlio@8407
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index ca06b891fc..a7566e3e94 100644
--- a/mg.c
+++ b/mg.c
@@ -2161,6 +2161,8 @@ Perl_sighandler(int sig)
U32 flags = 0;
I32 o_save_i = PL_savestack_ix;
XPV *tXpv = PL_Xpv;
+ sigjmp_buf jmp;
+ Sighandler_t handler;
#if defined(WIN32) && defined(PERL_IMPLICIT_CONTEXT)
PERL_SET_THX(aTHXo); /* fake TLS, see above */
@@ -2223,9 +2225,26 @@ Perl_sighandler(int sig)
PUSHs(sv);
PUTBACK;
- call_sv((SV*)cv, G_DISCARD);
+ call_sv((SV*)cv, G_DISCARD|G_EVAL);
POPSTACK;
+ if (SvTRUE(ERRSV)) {
+#ifdef HAS_SIGACTION
+ /* Handler "died", for example to get out of a restart-able read().
+ * Before we re-do that on its behalf re-enable the signal which was
+ * blocked by the system when we entered.
+ */
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set,sig);
+ sigprocmask(SIG_UNBLOCK, &set, NULL);
+#else
+ /* Not clear if this will work */
+ (void)rsignal(sig, SIG_IGN);
+ (void)rsignal(sig, PL_sighandlerp);
+#endif
+ Perl_die(aTHX_ Nullch);
+ }
cleanup:
if (flags & 1)
PL_savestack_ix -= 8; /* Unprotect save in progress. */