4 use PublicInbox::Syscall qw(:epoll);
5 plan skip_all => 'not Linux' if $^O ne 'linux';
6 my $epfd = epoll_create();
7 ok($epfd >= 0, 'epoll_create');
8 my $hnd = IO::Handle->new_from_fd($epfd, 'r+'); # close on exit
10 pipe(my ($r, $w)) or die "pipe: $!";
11 is(epoll_ctl($epfd, EPOLL_CTL_ADD, fileno($w), EPOLLOUT), 0,
12 'epoll_ctl socket EPOLLOUT');
15 is(epoll_wait($epfd, 100, 10000, \@events), 1, 'epoll_wait returns');
16 is_deeply(\@events, [ [ fileno($w), EPOLLOUT ] ], 'got expected events');
18 is(epoll_wait($epfd, 100, 0, \@events), 0, 'epoll_wait timeout');