about summary refs log tree commit
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-02-06 08:49:36 +0000
committerEric Wong <e@yhbt.net>2020-02-07 01:19:59 -0600
commit17e52476687e03fecd579f765ad6864cde0f4203 (patch)
tree21b9dffb7048d602f64c47e247068686ff116e36 /t
parent95bdac7f09c69036efed537a4d03d5bdd2ae4eb6 (diff)
downloadpublic-inbox-17e52476687e03fecd579f765ad6864cde0f4203.tar.gz
The x32 ABI allows users to take advantage of the extra
registers on x86-64 without the bloat of 64-bit pointers and
longs.

This ought to be significant since Perl was designed when 32-bit
was prevalent; and the common structs for ops, hashes, scalars,
and arrays use longs (SSize_t/Size_t) for things which should
never need 64-bits when processing emails.

Debian's x32 port seems to work quite nicely under a chroot
on an amd64 Linux system.  All tests pass under x32, now.
Diffstat (limited to 't')
-rw-r--r--t/epoll.t20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/epoll.t b/t/epoll.t
new file mode 100644
index 00000000..56ade672
--- /dev/null
+++ b/t/epoll.t
@@ -0,0 +1,20 @@
+use strict;
+use Test::More;
+use IO::Handle;
+use PublicInbox::Syscall qw(:epoll);
+plan skip_all => 'not Linux' if $^O ne 'linux';
+my $epfd = epoll_create();
+ok($epfd >= 0, 'epoll_create');
+my $hnd = IO::Handle->new_from_fd($epfd, 'r+'); # close on exit
+
+pipe(my ($r, $w)) or die "pipe: $!";
+is(epoll_ctl($epfd, EPOLL_CTL_ADD, fileno($w), EPOLLOUT), 0,
+    'epoll_ctl socket EPOLLOUT');
+
+my @events;
+is(epoll_wait($epfd, 100, 10000, \@events), 1, 'epoll_wait returns');
+is_deeply(\@events, [ [ fileno($w), EPOLLOUT ] ], 'got expected events');
+close $w;
+is(epoll_wait($epfd, 100, 0, \@events), 0, 'epoll_wait timeout');
+
+done_testing;