]> Sergey Matveev's repositories - public-inbox.git/commitdiff
portability: constants for NetBSD
authorEric Wong <e@yhbt.net>
Mon, 6 Apr 2020 20:23:01 +0000 (20:23 +0000)
committerEric Wong <e@yhbt.net>
Tue, 7 Apr 2020 19:37:32 +0000 (19:37 +0000)
NetBSD implements O_CLOEXEC, so let us use it to avoid
inadvertant FD sharing.  It also has the same value for SIGWINCH
as Linux and the other BSDs we support.

lib/PublicInbox/MultiMidQueue.pm
lib/PublicInbox/Sigfd.pm

index 3c28ebbc3bdee40f95d6a174596070835a4d2729..eb2ecf2f237077613be48e5ecbbee1d347b93c13 100644 (file)
@@ -8,7 +8,12 @@ use strict;
 use SDBM_File; # part of Perl standard library
 use Fcntl qw(O_RDWR O_CREAT);
 use File::Temp 0.19 (); # 0.19 for ->newdir
-my %e = (freebsd => 0x100000, linux => 0x80000, openbsd => 0x10000);
+my %e = (
+       freebsd => 0x100000,
+       linux => 0x80000,
+       netbsd => 0x400000,
+       openbsd => 0x10000,
+);
 my $O_CLOEXEC = $e{$^O} // 0;
 
 sub new {
index 2d27f6a1a7175deeff74d89d8c72017c68d07a09..f500902ea67c8fc533922b0de455ccad679d7ce9 100644 (file)
@@ -15,6 +15,7 @@ sub new {
        my $self = fields::new($class);
        my %signo = map {;
                my $cb = $sig->{$_};
+               # SIGWINCH is 28 on FreeBSD, NetBSD, OpenBSD
                my $num = ($_ eq 'WINCH' && $^O =~ /linux|bsd/i) ? 28 : do {
                        my $m = "SIG$_";
                        POSIX->$m;