From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/8] ipc: assume SOCK_SEQPACKET exists
Date: Mon, 18 Sep 2023 10:15:11 +0000 [thread overview]
Message-ID: <20230918101516.2477899-4-e@80x24.org> (raw)
In-Reply-To: <20230918101516.2477899-1-e@80x24.org>
The rest of our code does, and we haven't encountered a platform
we'd care about without it.
---
lib/PublicInbox/IPC.pm | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm
index fa084795..9388befd 100644
--- a/lib/PublicInbox/IPC.pm
+++ b/lib/PublicInbox/IPC.pm
@@ -16,9 +16,8 @@ use PublicInbox::DS qw(awaitpid);
use PublicInbox::Spawn;
use PublicInbox::OnDestroy;
use PublicInbox::WQWorker;
-use Socket qw(AF_UNIX SOCK_STREAM);
+use Socket qw(AF_UNIX SOCK_STREAM SOCK_SEQPACKET);
my $MY_MAX_ARG_STRLEN = 4096 * 33; # extra 4K for serialization
-my $SEQPACKET = eval { Socket::SOCK_SEQPACKET() }; # portable enough?
our @EXPORT_OK = qw(ipc_freeze ipc_thaw nproc_shards);
my ($enc, $dec);
# ->imports at BEGIN turns sereal_*_with_object into custom ops on 5.14+
@@ -374,7 +373,7 @@ sub wq_nonblock_do { # always async
sub _wq_worker_start {
my ($self, $oldset, $fields, $one, @cb_args) = @_;
my ($bcast1, $bcast2);
- $one or socketpair($bcast1, $bcast2, AF_UNIX, $SEQPACKET, 0) or
+ $one or socketpair($bcast1, $bcast2, AF_UNIX, SOCK_SEQPACKET, 0) or
die "socketpair: $!";
my $seed = rand(0xffffffff);
my $pid = fork // die "fork: $!";
@@ -409,11 +408,11 @@ sub _wq_worker_start {
# starts workqueue workers if Sereal or Storable is installed
sub wq_workers_start {
my ($self, $ident, $nr_workers, $oldset, $fields, @cb_args) = @_;
- ($send_cmd && $recv_cmd && defined($SEQPACKET)) or return;
+ ($send_cmd && $recv_cmd) or return;
return if $self->{-wq_s1}; # idempotent
$self->{-wq_s1} = $self->{-wq_s2} = undef;
- socketpair($self->{-wq_s1}, $self->{-wq_s2}, AF_UNIX, $SEQPACKET, 0) or
- die "socketpair: $!";
+ socketpair($self->{-wq_s1}, $self->{-wq_s2}, AF_UNIX, SOCK_SEQPACKET, 0)
+ or die "socketpair: $!";
$self->ipc_atfork_prepare;
$nr_workers //= $self->{-wq_nr_workers}; # was set earlier
my $sigset = $oldset // PublicInbox::DS::block_signals();
next prev parent reply other threads:[~2023-09-18 10:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 10:15 [PATCH 0/8] portability odds and ends Eric Wong
2023-09-18 10:15 ` [PATCH 1/8] ci/run: favor `make check' as the default target Eric Wong
2023-09-18 10:15 ` [PATCH 2/8] drop GNU nproc(1) support in favor of getconf(1) Eric Wong
2023-09-18 10:15 ` Eric Wong [this message]
2023-09-18 10:15 ` [PATCH 4/8] rename t/run.perl to xt/check-run Eric Wong
2023-09-18 10:15 ` [PATCH 5/8] makefile: avoid needless use of double-colon rules Eric Wong
2023-09-18 10:15 ` [PATCH 6/8] pop3d: split @FLOCK into $FLOCK_TMPL and @FLOCK_ORDER Eric Wong
2023-09-18 10:15 ` [PATCH 7/8] install/deps: more fixes Eric Wong
2023-09-18 10:15 ` [PATCH 8/8] makefile: avoid non-POSIX which(1) Eric Wong
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=20230918101516.2477899-4-e@80x24.org \
--to=e@80x24.org \
--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.
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).