hn.today

Systemd Loves Rust

amutable.com15 points4 comments
Screenshot of Systemd Loves Rust

Systemd has accepted Rust as an additional language for individual, “leaf” binaries, while keeping its foundational shared library and shared code in C for now. The distinction reflects systemd’s scale: it contains more than 180 small binaries, and putting Rust into core shared libraries without a stable ABI could duplicate Rust code across libraries and executables. Static linking is not a practical answer for such a system. Rust binaries will instead use Rust crates that expose systemd’s existing C APIs, so components in either language can draw on the same core functionality.

The integration is designed to preserve systemd’s established security practices and consistency. Rust and C binaries should share command-line conventions, help text, and error behavior. Systemd will continue using Meson rather than adding Cargo, limit external dependencies while it gains experience with the Rust ecosystem, and avoid Rust’s standard library where its filesystem APIs do not meet systemd’s security requirements. It also supplies its own allocator so allocation failures can be handled rather than causing panics. Existing C code will not be rewritten without a concrete reason, and Rust remains optional so unsupported architectures and users without Rust retain a working system. The maintainers welcome Rust’s benefits and hope future improvements, including shared-library support and file-descriptor-based filesystem APIs, may eventually make Rust suitable for core components.

Read on amutable.com4 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.