about summary refs log tree commit homepage
path: root/lib/PublicInbox/Syscall.pm
DateCommit message (Collapse)
2020-01-06syscall: modernize away from pre-Perl-5.6 conventions
"use vars" was superseded by "our" in Perl 5.6, and we can "use parent qw(Exporter)" in favor of manipulating @ISA directly (or the bigger "use base ..."); While we're at it, avoid multiple invocations of constant->import by passing a hashref as a "use" parameter.
2019-11-27httpd|nntpd: avoid missed signal wakeups
Our attempt at using a self-pipe in signal handlers was ineffective, since pure Perl code execution is deferred and Perl doesn't use an internal self-pipe/eventfd. In retrospect, I actually prefer the simplicity of Perl in this regard... We can use sigprocmask() from Perl, so we can introduce signalfd(2) and EVFILT_SIGNAL support on Linux and *BSD-based systems, respectively. These OS primitives allow us to avoid a race where Perl checks for signals right before epoll_wait() or kevent() puts the process to sleep. The (few) systems nowadays without signalfd(2) or IO::KQueue will now see wakeups every second to avoid missed signals.
2019-10-22syscall: get rid of sendfile wrappers for now
I'm not sure they'll make a measurable difference or will be worth the effort in the future given the prevalance of HTTPS and giant socket buffers. Using Inline::C for this may make more sense in the future, too, especially if we want to be able to use GnuTLS.
2019-06-29listener: use edge-triggered notifications
We don't need extra wakeups from the kernel when we know a listener is already active.
2019-06-24ds: split out IO::KQueue-specific code
We don't need to code multiple event loops or have branches in watch() if we can easily make the IO::KQueue-based interface look like our lower-level epoll_* API.
2019-06-24ds: get rid of event_watch field
We don't need to keep track of that field since we always know what events we're interested in when using one-shot wakeups.
2019-06-24syscall: get rid of unnecessary uname local vars
We don't need to keep information from uname(2) around outside of startup.
2019-06-24syscall: get rid of unused EPOLL* constants
EPOLLRDBAND is used for DECnet; and I'm pretty sure I won't be updating any of our code to work with DECnet. I've never found use for EPOLLHUP or EPOLLERR, either; so disable those for now and add comments for things I might actually use: EPOLLET and EPOLLONESHOT.
2019-05-08syscall: drop readahead wrapper
No backwards compatibility to worry about for us; and fadvise is superior anyways.
2019-05-05listener: use EPOLLEXCLUSIVE for listen sockets
Since our listen sockets are non-blocking and we may run multiple httpd|nntpd processes; we need a way to avoid thundering herds when there are multiple httpd|nntpd worker processes. EPOLLEXCLUSIVE was added just for that in Linux 4.5
2019-05-04bundle Danga::Socket and Sys::Syscall
These modules are unmaintained upstream at the moment, but I'll be able to help with the intended maintainer once/if CPAN ownership is transferred. OTOH, we've been waiting for that transfer for several years, now... Changes I intend to make: * EPOLLEXCLUSIVE for Linux * remove unused fields wasting memory * kqueue bugfixes e.g. https://rt.cpan.org/Ticket/Display.html?id=116615 * accept4 support And some lower priority experiments: * switch to EV_ONESHOT / EPOLLONESHOT (incompatible changes) * nginx-style buffering to tmpfile instead of string array * sendfile off tmpfile buffers * io_uring maybe?