Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Sep 2025 15:58:31 +0200
From:      Steffen Nurpmeso <steffen@sdaoden.eu>
To:        FreeBSD Current <freebsd-current@freebsd.org>
Cc:        Olivier Certner <olce@freebsd.org>, Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@freebsd.org>, Bob Bishop <rb@gid.co.uk>, Alan Somers <asomers@freebsd.org>, Toomas Soome <tsoome@me.com>
Subject:   Re: git: d549de769055 - main - libc: Remove readdir_r(3) [This broke building rust 1.88]
Message-ID:  <20250912135831.s1k7SkfL@steffen%sdaoden.eu>
In-Reply-To: <5035133.Cjmsv3J8Qz@ravel>
References:  <6053312.Zv9zXsTiuT@ravel> <86ms6zhmbq.fsf@ltc.des.dev> <5035133.Cjmsv3J8Qz@ravel>

index | next in thread | previous in thread | raw e-mail

Olivier Certner wrote in
 <5035133.Cjmsv3J8Qz@ravel>:
 |> readdir_r() should never have existed.
 ...
 |most programs calling it do not do the proper dance[.]
 ...
 |Yes, that's a fundamental problem for a flexible unionfs where the \
 |upper and lower layers can be changed underneath the union view.  But \
 |we have a workaround here: Simply return NAME_MAX[.]
 ...
 |>[.]It is
 |>   also faster than readdir_r().
 |
 |I completely agree, but see these more as points to actually obsolete \
 |readdir_r(), as POSIX just did (and we did long ago).  We'll eventually \
 |remove it anyway.

Only to mention that POSIX Issue 8 has posix_getdents() that
gives application programmers a good tool for flexible buffer
usage ("none to many" dirents in one go, as you need it), as well
as lots of *stat*(2) avoidance possibilities.  This is a real
improvement when available, and i hope the world will go this
route, so that the only optional getdirentries() / getdents()
/ getdents64() / readdir()+stat() dances will come to an end in
the future.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20250912135831.s1k7SkfL>