about summary refs log tree commit homepage
path: root/t/sigfd.t
DateCommit message (Collapse)
2023-09-11daemon: depend on DS event_loop in master process, too
The awaitpid API turns out to be quite handy for managing long-lived worker processes. This allows us to ensure all our uses of signalfd (and kevent emulation) are non-blocking.
2023-09-05t/sigfd: better checks related to SIGWINCH
Check to ensure there's a numeric value of SIGWINCH defined for the given platform. SIGWINCH may also fire while the test is running due to a user resizing their terminal, so a boolean test to ensure it fired rather than an exact value check is more correct.
2023-09-05t/sigfd: test EVFILT_SIGNAL vs signalfd differences
Verify that observed OpenBSD and FreeBSD EVFILT_SIGNAL behavior works differently than what Linux signalfd does to ease upcoming changes to PublicInbox::DS.
2023-04-07t/sigfd: avoid multiple Sigfd instances
This may fix sporadic test failures I've seen under FreeBSD 12.x when using kqueue with EVFILT_SIGNAL to emulate Linux signalfd.
2023-03-25ds: @post_loop_do replaces SetPostLoopCallback
This allows us to avoid repeatedly using memory-intensive anonymous subs in CodeSearchIdx where the callback is assigned frequently. Anonymous subs are known to leak memory in old Perls (e.g. 5.16.3 in enterprise distros) and still expensive in newer Perls. So favor the (\&subroutine, @args) form which allows us to eliminate anonymous subs going forward. Only CodeSearchIdx takes advantage of the new API at the moment, since it's the biggest repeat user of post-loop callback changes. Getting rid of the subroutine and relying on a global `our' variable also has two advantages: 1) Perl warnings can detect typos at compile-time, whereas the (now gone) method could only detect errors at run-time. 2) `our' variable assignment can be `local'-ized to a scope
2022-10-17sigfd: set SIGWINCH for MIPS and PA-RISC on Linux
SIGWINCH is actually different for these architectures on Linux according to the signal(7) man page. Note: AFAICS there's no parisc machine in the GCC Farm[1], so it remains untested. I've only tested mips64 for mips, but I expect them to both work. OpenBSD (on gcc231) octeon defines SIGWINCH as the common `28', so it appears Linux is the only one with arch-dependent signal numbers (ditto with syscalls). [1] https://cfarm.tetaneutral.net/machines/list/
2021-10-01ds: simplify signalfd use
Since signalfd is often combined with our event loop, give it a convenient API and reduce the code duplication required to use it. EventLoop is replaced with ::event_loop to allow consistent parameter passing and avoid needlessly passing the package name on stack. We also avoid exporting SFD_NONBLOCK since it's the only flag we support. There's no sense in having the memory overhead of a constant function when it's in cold code.
2021-06-18t/sigfd: add diagnostic for occasional FreeBSD failure
Not 100% sure what's going on, here...
2021-05-06t/sigfd: use PublicInbox::DS::block_signals
We already use PublicInbox::DS in this test and I've always found the terminology of sig* APIs confusing :x
2021-01-01update copyrights for 2021
Using "make update-copyrights" after setting GNULIB_PATH in my config.mak
2021-01-01syscall: SFD_NONBLOCK can be a constant, again
Since Perl exposes O_NONBLOCK as a constant, we can safely make SFD_NONBLOCK a constant, too. This is not the case for SFD_CLOEXEC, since O_CLOEXEC is not exposed by Perl despite being used internally in the interpreter.
2020-08-07syscall: support sparc64 (and maybe other big-endian systems)
Thanks to the GCC compile farm project, we can wire up syscalls for sparc64 and set system-specific SFD_* constants properly. I've FINALLY figured out how to use POSIX::SigSet to generate a usable buffer for the syscall perlfunc. This is required for endian-neutral behavior and relevant to sparc64, at least. There's no need for signalfd-related stuff to be constants, either. signalfd initialization is never a hot path and a stub subroutine for constants uses several KB of memory in the interpreter. We'll drop the needless SEEK_CUR import while we're importing O_NONBLOCK, too.
2020-02-06treewide: run update-copyrights from gnulib for 2019
I didn't wait until September to do it, this year!
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.