X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FSigfd.pm;h=81e5a1b1dd88e99d25bf37aadbb1f520e8a6503f;hb=1c52f49354aa83e71fcceccae888da0c77f2391d;hp=d91ea0e7ac78ae541edabc7b647c78224a48e3cc;hpb=5824d0d4ffac120a2840c980b4570868d6b3ea6b;p=public-inbox.git diff --git a/lib/PublicInbox/Sigfd.pm b/lib/PublicInbox/Sigfd.pm index d91ea0e7..81e5a1b1 100644 --- a/lib/PublicInbox/Sigfd.pm +++ b/lib/PublicInbox/Sigfd.pm @@ -6,13 +6,13 @@ package PublicInbox::Sigfd; use strict; use parent qw(PublicInbox::DS); -use PublicInbox::Syscall qw(signalfd EPOLLIN EPOLLET SFD_NONBLOCK); +use PublicInbox::Syscall qw(signalfd EPOLLIN EPOLLET); use POSIX (); # returns a coderef to unblock signals if neither signalfd or kqueue # are available. sub new { - my ($class, $sig, $flags) = @_; + my ($class, $sig, $nonblock) = @_; my %signo = map {; my $cb = $sig->{$_}; # SIGWINCH is 28 on FreeBSD, NetBSD, OpenBSD @@ -24,15 +24,15 @@ sub new { } keys %$sig; my $self = bless { sig => \%signo }, $class; my $io; - my $fd = signalfd(-1, [keys %signo], $flags); + my $fd = signalfd([keys %signo], $nonblock); if (defined $fd && $fd >= 0) { open($io, '+<&=', $fd) or die "open: $!"; } elsif (eval { require PublicInbox::DSKQXS }) { - $io = PublicInbox::DSKQXS->signalfd([keys %signo], $flags); + $io = PublicInbox::DSKQXS->signalfd([keys %signo], $nonblock); } else { return; # wake up every second to check for signals } - if ($flags & SFD_NONBLOCK) { # it can go into the event loop + if ($nonblock) { # it can go into the event loop $self->SUPER::new($io, EPOLLIN | EPOLLET); } else { # master main loop $self->{sock} = $io;