FreeBSD也要“锈化”?团队称考虑在基础系统采用Rust

学学看科技 2024-01-25 07:11:19

FreeBSD 开发者正在考虑允许在 FreeBSD 基础系统中使用 Rust 编程语言的好处和成本。

邮件写道,在 FreeBSD 基础系统使用 Rust 的主要缺点是构建时间加倍。这是因为需要编译基于 LLVM 的 Rustc 编译器和 Rust 的所有附加功能,这些操作使得基础系统的构建时间大约是当前的两倍。

如果 FreeBSD 基础系统采用了 Rust,开发者可以重新 Rust 重写许多组件 —— 而不是使用 C++,例如 ZFS 守护进程 (zfsd)、重写 devd、WiFi 用户空间代码也可以受益于用 Rust 编写,等等。列举部分如下:

* ctl-exporter (I started this, but discovered that the CTL stats API is unstable, so it can't live in ports. Instead, I had to do it in C). https://github.com/freebsd/freebsd-src/commit/1a7f22d9c211f504f6c48a86401469181a67ec34

* fusefs tests. Absolutely impossible to do in C. I considered Rust, but went with C++ so they could live in base. They are too closely coupled to fusefs(5) to live out-of-tree. https://github.com/freebsd/freebsd-src/tree/main/tests/sys/fs/fusefs

* devd. Currently C++, but imp suggested a rewrite. https://github.com/freebsd/freebsd-src/tree/main/sbin/devd

* zfsd. Currently C++, but I've long pondered a rewrite. Using Rust would make it more testable. https://github.com/freebsd/freebsd-src/tree/main/cddl/usr.sbin/zfsd

* nscd. Currently C, but confusing and with no test coverage. I've contemplated a rewrite myself, but I don't want to do it in C. https://github.com/freebsd/freebsd-src/tree/main/usr.sbin/nscd

* The userland portion of the 802.11ac and Lightning stacks. scottl suggested that these were good candidates for Rust.

* freebsd-kpi-r14-0 . https://crates.io/crates/freebsd-kpi-r14-0

1 阅读:222

学学看科技

简介:感谢大家的关注