Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Sep 2025 14:59:52 -0600
From:      Alan Somers <asomers@freebsd.org>
To:        FreeBSD CURRENT <freebsd-current@freebsd.org>
Subject:   The status of readdir_r in Rust
Message-ID:  <CAOtMX2gj%2BFV4Ok_GCjE==q3DBVdGL=_GTs00aB-NSgbtSffd-Q@mail.gmail.com>

index | next in thread | raw e-mail

[-- Attachment #1 --]
On 13-September we had a long conversation about readdir_r, about whether
modern applications should be using it (they shouldn't), and about whether
we should remove it entirely for FreeBSD 16 (no, at least not yet).  The
big problem was that lang/rust still used readdir_r in its standard
library, so we definitely need to preserve that function for now.

Since then I've submitted a PR to remove the readdir_r calls from the
standard library [^1].  I also updated libc to specifically bind to the
pre-FreeBSD 15 ELF symbol for readdir_r [^2], which ensures that
applications will continue to build even after we remove that function.
Finally, Github code search found several crates that are still using
readdir_r, but only one of them is a crate that I personally care about:
Nix.  So I did the same thing there that I did to the standard library [^3].

At this point, I think it should be safe to remove readdir_r from FreeBSD
16 in about six months, at least as far as Rust is concerned.

[^1]: https://github.com/rust-lang/rust/pull/146549
[^2]: https://github.com/rust-lang/libc/pull/4694
[^3]: https://github.com/nix-rust/nix/pull/2674

[-- Attachment #2 --]
<div dir="ltr"><div>On 13-September we had a long conversation about readdir_r, about whether modern applications should be using it (they shouldn&#39;t), and about whether we should remove it entirely for FreeBSD 16 (no, at least not yet).  The big problem was that lang/rust still used readdir_r in its standard library, so we definitely need to preserve that function for now.</div><div><br></div><div>Since then I&#39;ve submitted a PR to remove the readdir_r calls from the standard library [^1].  I also updated libc to specifically bind to the pre-FreeBSD 15 ELF symbol for readdir_r [^2], which ensures that applications will continue to build even after we remove that function.  Finally, Github code search found several crates that are still using readdir_r, but only one of them is a crate that I personally care about: Nix.  So I did the same thing there that I did to the standard library [^3].</div><div><br></div><div>At this point, I think it should be safe to remove readdir_r from FreeBSD 16 in about six months, at least as far as Rust is concerned.</div><div><br></div><div>[^1]: <a href="https://github.com/rust-lang/rust/pull/146549">https://github.com/rust-lang/rust/pull/146549</a></div><div>[^2]: <a href="https://github.com/rust-lang/libc/pull/4694">https://github.com/rust-lang/libc/pull/4694</a></div><div>[^3]: <a href="https://github.com/nix-rust/nix/pull/2674">https://github.com/nix-rust/nix/pull/2674</a></div></div>;
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2gj%2BFV4Ok_GCjE==q3DBVdGL=_GTs00aB-NSgbtSffd-Q>