our @EXPORT_OK = qw(epoll_ctl epoll_wait);
my $owner_pid = -1; # kqueue is close-on-fork (yes, fork, not exec)
+sub EV_DISPATCH () { 0x0080 }
+
# map EPOLL* bits to kqueue EV_* flags for EV_SET
sub kq_flag ($$) {
my ($bit, $ev) = @_;
--- /dev/null
+# Copyright (C) 2019 all contributors <meta@public-inbox.org>
+# Licensed the same as Danga::Socket (and Perl5)
+# License: GPL-1.0+ or Artistic-1.0-Perl
+# <https://www.gnu.org/licenses/gpl-1.0.txt>
+# <https://dev.perl.org/licenses/artistic.html>
+use strict;
+use Test::More;
+unless (eval { require IO::KQueue }) {
+ my $m = $^O !~ /bsd/ ? 'DSKQXS is only for *BSD systems'
+ : "no IO::KQueue, skipping $0: $@";
+ plan skip_all => $m;
+}
+local $ENV{TEST_IOPOLLER} = 'PublicInbox::DSKQXS';
+require './t/ds-poll.t';
use warnings;
use Test::More;
use PublicInbox::Syscall qw(:epoll);
-my $cls = 'PublicInbox::DSPoll';
+my $cls = $ENV{TEST_IOPOLLER} // 'PublicInbox::DSPoll';
use_ok $cls;
my $p = $cls->new;
my @exp = sort((fileno($r), fileno($x)));
is_deeply(\@fds, \@exp, 'got both ready FDs');
-# EPOLL_CTL_DEL doesn't matter for kqueue, we do it in native epoll
-# to avoid a kernel-wide lock; but its not needed for native kqueue
-# paths so DSKQXS makes it a noop (as did Danga::Socket::close).
-SKIP: {
- if ($cls ne 'PublicInbox::DSPoll') {
- skip "$cls doesn't handle EPOLL_CTL_DEL", 2;
- }
- is($p->epoll_ctl(EPOLL_CTL_DEL, fileno($r), 0), 0, 'EPOLL_CTL_DEL OK');
- $n = $p->epoll_wait(9, 0, $events);
- is($n, 0, 'nothing ready after EPOLL_CTL_DEL');
-};
+is($p->epoll_ctl(EPOLL_CTL_DEL, fileno($r), 0), 0, 'EPOLL_CTL_DEL OK');
+$n = $p->epoll_wait(9, 0, $events);
+is($n, 0, 'nothing ready after EPOLL_CTL_DEL');
done_testing;