Skip to content
Home » FreeBSD Developers Explore Rust Integration

FreeBSD Developers Explore Rust Integration

FreeBSD developers are assessing the possibility and benefits of bringing Rust into the base system.

In a recent development that could reshape the FreeBSD development path, Alan Somers, the mind behind the new FUSE driver implementation for FreeBSD, initiated discussions on incorporating the Rust programming language into the operating system’s base system.

Somers, also credited for authoring Rust wrappers for essential FreeBSD libraries, engaged in a comprehensive conversation with project committers to evaluate the costs and benefits of integrating Rust into the FreeBSD base system.

The primary cost identified during the discussions is a potential doubling of build times. Alan Somers suggested mitigating this by introducing an additional step after the ‘buildworld’ process for tasks requiring an external toolchain. This strategic move aims to alleviate the impact on build times while unlocking many benefits that Rust integration could offer.

The significant benefit highlighted in these discussions is the simplification and empowerment of utility development. Rust’s entry into the FreeBSD base system opens up new possibilities and efficiencies for developers, making the creation of certain tools more straightforward and, in some cases, even feasible. To clarify, a list of utilities has been compiled, most currently written in C++ and C, indicating potential candidates for rewriting in Rust.

FreeBSD 14
FreeBSD 14

List of utilities that the team intend to rewrite in Rust if Rust support were to appear in the base system:

  • ctl-exporter: Exports FreeBSD system statistics for consumption by monitoring tools.
  • fusefs tests: Unit tests for the FUSE (Filesystem in Userspace) virtual filesystem implementation.
  • devd: Dynamically manages device nodes based on hardware presence and configuration.
  • zfsd: Primary daemon for the ZFS filesystem, handling tasks like metadata management and I/O operations.
  • nscd: Name Service Cache Daemon, caching DNS and NIS (Network Information Service) lookups for faster access.
  • Components of 802.11ac and Lightning stacks running in user space: Drivers and utilities for managing wireless network interfaces using the 802.11ac and Lightning protocols.
  • freebsd-kpi-r14-0: Kernel Programming Interface (KPI) header files for FreeBSD version 14.0, enabling user-space programs to interact with the kernel.

List of ports to the Rust language that could be ported to the base system if Rust support were introduced to the base system:

  • gstat-rs: Exposes hardware sensor data (temperature, fan speeds, etc.) for Prometheus monitoring.
  • geom-exporter: Scrapes performance metrics from FreeBSD disk geometry modules for Prometheus.
  • nfs-exporter: Shares NFS server statistics with Prometheus for monitoring NAS performance.
  • virtiofsd-rs: Implements the virtio-fs filesystem using Rust, enabling direct access to virtual disks.
  • jail-exporter: Exports metrics about FreeBSD jails (isolated user environments) for Prometheus.

Various jail environment management systems which are already in Rust:

  • pjdfstest: This is a testing framework specifically designed for testing FreeBSD jails. It allows developers and system administrators to write automated tests for jail startup, configuration, and behaviour.
  • pf-rs: As mentioned earlier, pf-rs is a next-generation packet filter firewall that can be used in conjunction with jails. It offers advanced features and potential integration with Rust tooling, making it a powerful option for jail firewall management.
  • benchpmc: This tool focuses on performance benchmarking of jails. It allows you to compare the performance of different jail configurations and settings, helping you optimize your jail setup for specific workloads.

As FreeBSD developers weigh the trade-offs of build time increases against the promise of streamlined utility development, the potential benefits of integrating Rust into the base system would make FreeBSD more robust in the coming days.

Learn more in the discussion at the mailing list.

Recent articles from

Notify of

1 Comment
Newest Most Voted
Inline Feedbacks
View all comments