about summary refs log tree commit homepage
path: root/lib/PublicInbox/Syscall.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-05-06 08:38:53 +0000
committerEric Wong <e@80x24.org>2021-05-06 16:56:45 +0000
commit8b7fbce5c50b51610f3ea69412ea5b19d7d38537 (patch)
treeee772965f80d076cd058f294795d194d22c58a0e /lib/PublicInbox/Syscall.pm
parentde20dc26cd22271327e8a84818ff0774cecc1361 (diff)
downloadpublic-inbox-8b7fbce5c50b51610f3ea69412ea5b19d7d38537.tar.gz
FreeBSD (and other *BSDs) do not have stable syscall numbers, so
drop no-op checks for it and add a note to use Inline::C,
instead.  Drop an implicit return for the syscall.ph loading
while we're at it, too.

On Linux, epoll_create(2) ignores the size arg since Linux
2.6.8, so just hard code it to some non-zero value.

On a side note, we can probably drop epoll_create(2) support
soon and just use epoll_create1(2) which appeared in 2.6.27+
(2008-10-09).  Our userspace (Perl and git) requirements are
already further ahead.
Diffstat (limited to 'lib/PublicInbox/Syscall.pm')
-rw-r--r--lib/PublicInbox/Syscall.pm14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm
index 5ff1d65f..2599f8a3 100644
--- a/lib/PublicInbox/Syscall.pm
+++ b/lib/PublicInbox/Syscall.pm
@@ -55,7 +55,7 @@ sub _load_syscall {
     $clean->(); # don't trust modules before us
     my $rv = eval { require 'syscall.ph'; 1 } || eval { require 'sys/syscall.ph'; 1 };
     $clean->(); # don't require modules after us trust us
-    return $rv;
+    $rv;
 }
 
 
@@ -195,21 +195,17 @@ if ($^O eq "linux") {
         *epoll_ctl = \&epoll_ctl_mod4;
     }
 }
-
-elsif ($^O eq "freebsd") {
-    if ($ENV{FREEBSD_SENDFILE}) {
-        # this is still buggy and in development
-    }
-}
+# use Inline::C for *BSD-only or general POSIX stuff.
+# Linux guarantees stable syscall numbering, BSDs only offer a stable libc
 
 ############################################################################
 # epoll functions
 ############################################################################
 
-sub epoll_defined { return $SYS_epoll_create ? 1 : 0; }
+sub epoll_defined { $SYS_epoll_create ? 1 : 0; }
 
 sub epoll_create {
-        syscall($SYS_epoll_create, $no_deprecated ? 0 : ($_[0]||100)+0);
+        syscall($SYS_epoll_create, $no_deprecated ? 0 : 100);
 }
 
 # epoll_ctl wrapper