about summary refs log tree commit homepage
path: root/lib/PublicInbox/IPC.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-09-18 10:15:11 +0000
committerEric Wong <e@80x24.org>2023-09-20 19:14:20 +0000
commit2a6063fbc45803150596be0d615e8618f7126b21 (patch)
treeb5d70d2373a4d0d9090808bbcc58b3ab43fc067a /lib/PublicInbox/IPC.pm
parent6b70d5f03b688ee24df38ea669c0d800a6ad3b49 (diff)
downloadpublic-inbox-2a6063fbc45803150596be0d615e8618f7126b21.tar.gz
The rest of our code does, and we haven't encountered a platform
we'd care about without it.
Diffstat (limited to 'lib/PublicInbox/IPC.pm')
-rw-r--r--lib/PublicInbox/IPC.pm11
1 files 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();