]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
ds: use constants for @UNBLOCKABLE list
authorEric Wong <e@80x24.org>
Mon, 11 Sep 2023 09:41:31 +0000 (09:41 +0000)
committerEric Wong <e@80x24.org>
Mon, 11 Sep 2023 18:51:17 +0000 (18:51 +0000)
There's no need for for a complicated map {} block here.  All
these unblockable signals are POSIX since 2001 at the latest, so
there's no reason any platform would lack them.

lib/PublicInbox/DS.pm

index f2b147996f369ea2bb58ece7f36e2fc0d3e6ddcb..b3edc094f01e1798dbf234d3893cb02e1a2133a4 100644 (file)
@@ -186,11 +186,9 @@ sub RunTimers {
 
 sub sig_setmask { sigprocmask(SIG_SETMASK, @_) or die "sigprocmask: $!" }
 
-our @UNBLOCKABLE = map { # ensure we detect bugs, HW problems and user rlimits
-       my $cb = POSIX->can("SIG$_");
-       my $num = $cb ? $cb->() : undef;
-       $num ? ($num) : ();
-} qw(ABRT BUS FPE ILL SEGV XCPU XFSZ);
+# ensure we detect bugs, HW problems and user rlimits
+our @UNBLOCKABLE = (POSIX::SIGABRT, POSIX::SIGBUS, POSIX::SIGFPE,
+       POSIX::SIGILL, POSIX::SIGSEGV, POSIX::SIGXCPU, POSIX::SIGXFSZ);
 
 sub block_signals { # anything in @_ stays unblocked
        my $newset = POSIX::SigSet->new;