Experimental signal backends for beckon
built entirely on the Java Foreign Function & Memory API (JDK 22+), as an
alternative to beckon's default sun.misc.Signal backend:
- Linux -
signalfd(2) - macOS / BSD -
kqueue(2)withEVFILT_SIGNAL
It exists because sun.misc.Signal is an internal JDK API that may eventually be
removed; this proves out the supported modern replacement. It is experimental
and shipped separately precisely because it needs JDK 22+, while beckon's core
jar targets JDK 8.
Use beckon by default. Add
beckon-ffm only when you want the experimental Foreign Function & Memory
backend and can run on JDK 22+.
Add both artifacts, then opt in with a system property.
[net.clojars.savya/beckon "0.4.1"]
[net.clojars.savya/beckon-ffm "0.1.1"]Run the JVM with:
-Dbeckon.signal.backend=ffm --enable-native-access=ALL-UNNAMED
The right native mechanism is selected automatically for the platform. The beckon API is unchanged - see the beckon README.
The two implementations differ, which is instructive:
- Linux (
signalfd) reliably handles beckon's ownraise!, but not signals from outside the process (e.g.kill -HUP): a JVM starts threads before beckon loads, andsignalfdonly captures a signal blocked in every thread, which cannot be arranged retroactively. - macOS/BSD (
kqueue) sets each managed signal toSIG_IGN- a process-wide disposition - so it also observes external signals.
Because of the Linux limitation and JEP 472 native-access restrictions
(--enable-native-access, denied by default from JDK 26), this is not a drop-in
replacement; sun.misc.Signal remains beckon's default.
Requires JDK 22 or later (Foreign Function & Memory API, JEP 454). Linux and macOS/BSD only. Continuously tested on JDK 25 across Ubuntu and macOS.
Copyright © 2026 Savyasachi.
A companion to beckon (originally by Jean Niklas L'orange). Distributed under the Eclipse Public License, the same as Clojure.