This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove deprecated PERL_OBJECT cruft, it has long since stopped
[perl5.git] / ext / POSIX / POSIX.xs
index 1bf8521..60469a3 100644 (file)
@@ -19,7 +19,7 @@
 #define PERLIO_NOT_STDIO 1
 #include "perl.h"
 #include "XSUB.h"
-#if defined(PERL_OBJECT) || defined(PERL_CAPI) || defined(PERL_IMPLICIT_SYS)
+#if defined(PERL_IMPLICIT_SYS)
 #  undef signal
 #  undef open
 #  undef setmode
@@ -522,14 +522,15 @@ __END__
 }
 
 static void
-restore_sigmask(sigset_t *ossetp)
+restore_sigmask(pTHX_ SV *osset_sv)
 {
-           /* Fortunately, restoring the signal mask can't fail, because
-            * there's nothing we can do about it if it does -- we're not
-            * supposed to return -1 from sigaction unless the disposition
-            * was unaffected.
-            */
-           (void)sigprocmask(SIG_SETMASK, ossetp, (sigset_t *)0);
+     /* Fortunately, restoring the signal mask can't fail, because
+      * there's nothing we can do about it if it does -- we're not
+      * supposed to return -1 from sigaction unless the disposition
+      * was unaffected.
+      */
+     sigset_t *ossetp = (sigset_t *) SvPV_nolen( osset_sv );
+     (void)sigprocmask(SIG_SETMASK, ossetp, (sigset_t *)0);
 }
 
 MODULE = SigSet                PACKAGE = POSIX::SigSet         PREFIX = sig
@@ -1185,6 +1186,7 @@ sigaction(sig, optaction, oldaction = 0)
            struct sigaction act;
            struct sigaction oact;
            sigset_t sset;
+           SV *osset_sv;
            sigset_t osset;
            POSIX__SigSet sigset;
            SV** svp;
@@ -1215,7 +1217,9 @@ sigaction(sig, optaction, oldaction = 0)
                XSRETURN_UNDEF;
            ENTER;
            /* Restore signal mask no matter how we exit this block. */
-           SAVEDESTRUCTOR(restore_sigmask, &osset);
+           osset_sv = newSVpv((char *)(&osset), sizeof(sigset_t));
+           SAVEFREESV( osset_sv );
+           SAVEDESTRUCTOR_X(restore_sigmask, osset_sv);
 
            RETVAL=-1; /* In case both oldaction and action are 0. */