user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] portability: constants for NetBSD
@ 2020-04-06 20:23 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-04-06 20:23 UTC (permalink / raw)
  To: meta

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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-06 20:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 20:23 [PATCH] portability: constants for NetBSD Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).