From: Jarkko Hietaniemi Date: Fri, 8 Aug 2003 18:59:40 +0000 (+0000) Subject: Move the csighandler to be a data variable so that X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5c1546dc48d585e2ab2e244b01f0213280b12017;p=p5sagit%2Fp5-mst-13.2.git Move the csighandler to be a data variable so that things like DLL trampolines can't mess up the code variables the Perl_csighandler (seen in Cygwin: Perl_csighandler in POSIX extension was different than in main executable). p4raw-id: //depot/perl@20565 --- diff --git a/embedvar.h b/embedvar.h index 21d166c..a4f4a92 100644 --- a/embedvar.h +++ b/embedvar.h @@ -896,6 +896,7 @@ #define PL_No (PL_Vars.GNo) #define PL_Yes (PL_Vars.GYes) +#define PL_csighandlerp (PL_Vars.Gcsighandlerp) #define PL_curinterp (PL_Vars.Gcurinterp) #define PL_do_undump (PL_Vars.Gdo_undump) #define PL_dollarzero_mutex (PL_Vars.Gdollarzero_mutex) @@ -912,6 +913,7 @@ #define PL_GNo PL_No #define PL_GYes PL_Yes +#define PL_Gcsighandlerp PL_csighandlerp #define PL_Gcurinterp PL_curinterp #define PL_Gdo_undump PL_do_undump #define PL_Gdollarzero_mutex PL_dollarzero_mutex diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 3798152..10ba175 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1293,7 +1293,7 @@ sigaction(sig, optaction, oldaction = 0) /* Get back whether the old handler used safe signals. */ svp = hv_fetch(oldaction, "SAFE", 4, TRUE); - sv_setiv(*svp, oact.sa_handler == Perl_csighandler); + sv_setiv(*svp, oact.sa_handler == PL_csighandlerp); } if (action) { diff --git a/mg.c b/mg.c index dc1666a..b272c7a 100644 --- a/mg.c +++ b/mg.c @@ -1144,7 +1144,7 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg) #endif #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS sig_defaulting[i] = 1; - (void)rsignal(i, &Perl_csighandler); + (void)rsignal(i, PL_csighandlerp); #else (void)rsignal(i, SIG_DFL); #endif @@ -1183,7 +1183,7 @@ Perl_csighandler(int sig) dTHX; #endif #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS - (void) rsignal(sig, &Perl_csighandler); + (void) rsignal(sig, PL_csighandlerp); if (sig_ignoring[sig]) return; #endif #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS @@ -1213,7 +1213,7 @@ Perl_csighandler_init(void) #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS dTHX; sig_defaulting[sig] = 1; - (void) rsignal(sig, &Perl_csighandler); + (void) rsignal(sig, PL_csighandlerp); #endif #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS sig_ignoring[sig] = 0; @@ -1306,7 +1306,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) } if (SvTYPE(sv) == SVt_PVGV || SvROK(sv)) { if (i) { - (void)rsignal(i, &Perl_csighandler); + (void)rsignal(i, PL_csighandlerp); #ifdef HAS_SIGPROCMASK LEAVE; #endif @@ -1322,7 +1322,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) if (i) { #ifdef FAKE_PERSISTENT_SIGNAL_HANDLERS sig_ignoring[i] = 1; - (void)rsignal(i, &Perl_csighandler); + (void)rsignal(i, PL_csighandlerp); #else (void)rsignal(i, SIG_IGN); #endif @@ -1333,7 +1333,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) #ifdef FAKE_DEFAULT_SIGNAL_HANDLERS { sig_defaulting[i] = 1; - (void)rsignal(i, &Perl_csighandler); + (void)rsignal(i, PL_csighandlerp); } #else (void)rsignal(i, SIG_DFL); @@ -1348,7 +1348,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) if (!strchr(s,':') && !strchr(s,'\'')) sv_insert(sv, 0, 0, "main::", 6); if (i) - (void)rsignal(i, &Perl_csighandler); + (void)rsignal(i, PL_csighandlerp); else *svp = SvREFCNT_inc(sv); } @@ -2518,7 +2518,7 @@ Perl_sighandler(int sig) #else /* Not clear if this will work */ (void)rsignal(sig, SIG_IGN); - (void)rsignal(sig, &Perl_csighandler); + (void)rsignal(sig, PL_csighandlerp); #endif #endif /* !PERL_MICRO */ Perl_die(aTHX_ Nullformat); diff --git a/perlapi.h b/perlapi.h index 4782b32..639f70c 100644 --- a/perlapi.h +++ b/perlapi.h @@ -930,6 +930,8 @@ END_EXTERN_C #define PL_No (*Perl_GNo_ptr(NULL)) #undef PL_Yes #define PL_Yes (*Perl_GYes_ptr(NULL)) +#undef PL_csighandlerp +#define PL_csighandlerp (*Perl_Gcsighandlerp_ptr(NULL)) #undef PL_curinterp #define PL_curinterp (*Perl_Gcurinterp_ptr(NULL)) #undef PL_do_undump diff --git a/perlvars.h b/perlvars.h index 83124d8..e0f6530 100644 --- a/perlvars.h +++ b/perlvars.h @@ -63,3 +63,5 @@ PERLVAR(Gsigfpe_saved, Sighandler_t) * The contents are never used, only the address. */ PERLVAR(Gsv_placeholder, SV) +PERLVARI(Gcsighandlerp, Sighandler_t, &Perl_csighandler) /* Pointer to C-level sighandler */ +