unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH] portability: constants for NetBSD
Date: Mon,  6 Apr 2020 20:23:01 +0000	[thread overview]
Message-ID: <20200406202301.785-1-e@yhbt.net> (raw)

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;

                 reply	other threads:[~2020-04-06 20:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200406202301.785-1-e@yhbt.net \
    --to=e@yhbt.net \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).