r/systemd • u/fdelux6 • 19d ago
systemd developers explain how Rust will be used: standalone components only, core libraries stay in C
https://amutable.com/blog/systemd-loves-rust
10
Upvotes
0
u/amarao_san 19d ago
... stay in C, because nowadays software in C loves to receive unexpected updates against unexpected "features".
4
u/fdelux6 19d ago edited 19d ago
EDIT: added "for now" to match the post.
Short summary for anyone who doesn't want to read the whole post.
systemd merged Rust support recently (PR #44324). Rust is allowed for standalone binaries only. The core shared library, libsystemd-shared.so, stays C for now. The authors say the blocker is Rust's lack of first-class shared library support (the stable ABI problem). Without it, Rust code would be duplicated across many libraries and binaries.
The core C functionality is wrapped as Rust crates. Rust binaries use the same internal APIs as the C ones. Rust and C binaries are meant to behave the same, including option parsing, help output and error messages.
Rust is built with Meson, not Cargo. Cargo was rejected over the extra build system and supply chain concerns. Rust code uses no_std for now, with fallible allocations through a systemd allocator crate. External crates are not ruled out, but the project wants more experience first.
They also say existing C code won't be rewritten just to switch languages. Rust support stays optional for now, and systemd without Rust remains fully supported.
The post was written by Christian Brauner and Lennart Poettering.