From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DF5DD1F5AD for ; Mon, 6 Apr 2020 20:23:01 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] portability: constants for NetBSD Date: Mon, 6 Apr 2020 20:23:01 +0000 Message-Id: <20200406202301.785-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 7 ++++++- lib/PublicInbox/Sigfd.pm | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/MultiMidQueue.pm b/lib/PublicInbox/MultiMidQueue.pm index 3c28ebbc..eb2ecf2f 100644 --- a/lib/PublicInbox/MultiMidQueue.pm +++ b/lib/PublicInbox/MultiMidQueue.pm @@ -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 { diff --git a/lib/PublicInbox/Sigfd.pm b/lib/PublicInbox/Sigfd.pm index 2d27f6a1..f500902e 100644 --- a/lib/PublicInbox/Sigfd.pm +++ b/lib/PublicInbox/Sigfd.pm @@ -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;