package PublicInbox::CidxLogP;
use v5.12;
use parent qw(PublicInbox::DS);
-use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT);
+use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT $F_SETPIPE_SZ);
sub new {
my ($cls, $rd, $cidx, $git, $roots) = @_;
my $self = bless { cidx => $cidx, git => $git, roots => $roots }, $cls;
- fcntl($rd, 1031, 1048576) if $^O eq 'linux'; # fatter pipes
+ fcntl($rd, $F_SETPIPE_SZ, 1048576) if $F_SETPIPE_SZ;
$self->SUPER::new($rd, EPOLLIN|EPOLLONESHOT);
}
package PublicInbox::EOFpipe;
use v5.12;
use parent qw(PublicInbox::DS);
-use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT);
+use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT $F_SETPIPE_SZ);
sub new {
my (undef, $rd, $cb) = @_;
my $self = bless { cb => $cb }, __PACKAGE__;
- # 1031: F_SETPIPE_SZ, 4096: page size
- fcntl($rd, 1031, 4096) if $^O eq 'linux';
+ # 4096: page size
+ fcntl($rd, $F_SETPIPE_SZ, 4096) if $F_SETPIPE_SZ;
$self->SUPER::new($rd, EPOLLIN|EPOLLONESHOT);
}
use PublicInbox::ContentHash qw(git_sha);
use POSIX qw(strftime);
use autodie qw(open read seek truncate);
+use PublicInbox::Syscall qw($F_SETPIPE_SZ);
sub new {
my ($class) = @_;
if ($lei->{opt}->{augment} && delete $lei->{early_mua}) {
$lei->start_mua;
}
- my $F_SETPIPE_SZ = $^O eq 'linux' ? 1031 : undef;
if ($l2m->{-wq_nr_workers} > 1 &&
$l2m->{base_type} =~ /\A(?:maildir|mbox)\z/) {
# setup two barriers to coordinate ->has_entries
use v5.12;
use parent qw(PublicInbox::SearchIdx PublicInbox::IPC);
use PublicInbox::OnDestroy;
+use PublicInbox::Syscall qw($F_SETPIPE_SZ);
sub new {
my ($class, $v2w, $shard) = @_; # v2w may be ExtSearchIdx
if ($v2w->{parallel}) {
local $self->{-v2w_afc} = $v2w;
$self->ipc_worker_spawn("shard[$shard]");
- # F_SETPIPE_SZ = 1031 on Linux; increasing the pipe size for
- # inputs speeds V2Writable batch imports across 8 cores by
- # nearly 20%. Since any of our responses are small, make
- # the response pipe as small as possible
- if ($^O eq 'linux') {
- fcntl($self->{-ipc_req}, 1031, 1048576);
- fcntl($self->{-ipc_res}, 1031, 4096);
+ # Increasing the pipe size for requests speeds V2 batch imports
+ # across 8 cores by nearly 20%. Since many of our responses
+ # are small, make the response pipe as small as possible
+ if ($F_SETPIPE_SZ) {
+ fcntl($self->{-ipc_req}, $F_SETPIPE_SZ, 1048576);
+ fcntl($self->{-ipc_res}, $F_SETPIPE_SZ, 4096);
}
}
$self;
EPOLLIN EPOLLOUT EPOLLET
EPOLL_CTL_ADD EPOLL_CTL_DEL EPOLL_CTL_MOD
EPOLLONESHOT EPOLLEXCLUSIVE
- signalfd rename_noreplace %SIGNUM);
+ signalfd rename_noreplace %SIGNUM $F_SETPIPE_SZ);
use constant {
EPOLLIN => 1,
EPOLLOUT => 4,
my @BYTES_4_hole = BYTES_4_hole ? (0) : ();
-our (
- $SYS_epoll_create,
- $SYS_epoll_ctl,
- $SYS_epoll_wait,
- $SYS_signalfd4,
- $SYS_renameat2,
- );
+our ($SYS_epoll_create,
+ $SYS_epoll_ctl,
+ $SYS_epoll_wait,
+ $SYS_signalfd4,
+ $SYS_renameat2,
+ $F_SETPIPE_SZ);
my ($SYS_sendmsg, $SYS_recvmsg);
my $SYS_fstatfs; # don't need fstatfs64, just statfs.f_type
our $no_deprecated = 0;
if ($^O eq "linux") {
+ $F_SETPIPE_SZ = 1031;
my (undef, undef, $release, undef, $machine) = POSIX::uname();
my ($maj, $min) = ($release =~ /\A([0-9]+)\.([0-9]+)/);
$SYS_renameat2 = 0 if "$maj.$min" < 3.15;
use Cwd qw(abs_path);
require_mods('PublicInbox::Gcf2');
use_ok 'PublicInbox::Gcf2';
+use PublicInbox::Syscall qw($F_SETPIPE_SZ);
use PublicInbox::Import;
my ($tmpdir, $for_destroy) = tmpdir();
for my $blk (1, 0) {
my ($r, $w);
pipe($r, $w) or BAIL_OUT $!;
- fcntl($w, 1031, 4096) or
+ fcntl($w, $F_SETPIPE_SZ, 4096) or
skip('Linux too old for F_SETPIPE_SZ', 14);
$w->blocking($blk);
seek($fh, 0, SEEK_SET) or BAIL_OUT "seek: $!";
$ck_copying->("pipe blocking($blk)");
pipe($r, $w) or BAIL_OUT $!;
- fcntl($w, 1031, 4096) or BAIL_OUT $!;
+ fcntl($w, $F_SETPIPE_SZ, 4096) or BAIL_OUT $!;
$w->blocking($blk);
close $r;
local $SIG{PIPE} = 'IGNORE';
use PublicInbox::TestCommon;
use POSIX qw(WTERMSIG WIFSIGNALED SIGPIPE);
use PublicInbox::OnDestroy;
+use PublicInbox::Syscall qw($F_SETPIPE_SZ);
# undo systemd (and similar) ignoring SIGPIPE, since lei expects to be run
# from an interactive terminal:
my $imported;
for my $out ([], [qw(-f mboxcl2)], [qw(-f text)]) {
pipe(my ($r, $w)) or BAIL_OUT $!;
- my $size = 65536;
- if ($^O eq 'linux' && fcntl($w, 1031, 4096)) {
- $size = 4096;
- }
+ my $size = $F_SETPIPE_SZ && fcntl($w, $F_SETPIPE_SZ, 4096) ?
+ 4096 : 65536;
unless (-f $f) {
open my $fh, '>', $f or xbail "open $f: $!";
print $fh <<'EOM' or xbail;