Skip to content

beckon-ffm

Clojars Project cljdoc test

Experimental signal backends for beckon use only the Java Foreign Function & Memory API (JDK 22+). Use them as an alternative to beckon's default sun.misc.Signal backend:

  • Linux - signalfd(2)
  • macOS / BSD - kqueue(2) with EVFILT_SIGNAL

sun.misc.Signal is an internal JDK API. The JDK can remove it. This library tests a supported replacement. It is experimental and ships separately because it requires JDK 22+. The beckon core jar targets JDK 8.

Stack

Clojure Java FFM deps.edn tools.build

Installation

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 {:mvn/version "0.4.1"}
net.clojars.savya/beckon-ffm {:mvn/version "0.1.7"}

Leiningen:

[net.clojars.savya/beckon "0.4.1"]
[net.clojars.savya/beckon-ffm "0.1.7"]

Run the JVM with:

-Dbeckon.signal.backend=ffm --enable-native-access=ALL-UNNAMED

The platform selects the native mechanism automatically. The beckon API does not change. See the beckon README.

Capabilities and limits

The two implementations differ:

  • Linux (signalfd) reliably handles beckon's own raise!. It does not reliably handle signals from outside the process (e.g. kill -HUP). A JVM starts threads before beckon loads. signalfd only captures a signal blocked in every thread. beckon cannot arrange this after the JVM starts.
  • macOS/BSD (kqueue) sets each managed signal to SIG_IGN. This is a process-wide disposition. It also observes external signals.

The Linux limitation and JEP 472 native-access restrictions mean this is not a drop-in replacement. --enable-native-access is denied by default from JDK 26. sun.misc.Signal remains beckon's default.

Compatibility

Requires JDK 22 or later (Foreign Function & Memory API, JEP 454). Linux and macOS/BSD only. CI compiles and tests on JDK 22.

Development

Use JDK 22. Compile the two Java FFM backends before running the test suite:

clojure -T:build compile-java
clojure -M:test
clojure -T:build jar

License

Copyright © 2026 Savyasachi.

A companion to beckon (originally by Jean Niklas L'orange). Distributed under the Eclipse Public License 1.0.

About

Experimental FFM signal backends for beckon (Linux signalfd, macOS kqueue)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages