[TUHS] Quick Question: Early Filesystems and Name/Metadata Separation?

Steffen Nurpmeso via TUHS tuhs at tuhs.org
Thu Sep 18 00:36:24 AEST 2025


Leah Neukirchen via TUHS wrote in
 <87y0qdfku1.fsf at vuxu.org>:
 |Dan Cross via TUHS <tuhs at tuhs.org> writes:
 |
 |> Lookups---the most common
 |> operation---remained simple: to retrieve the "next" entry in a
 |> directory, one need only add the offset from the current entry to that
 |> entry's position relative to the start of the directory file, but that
 |> was an extra step compared to what workaday programmers were used to
 |> doing (which was just opening the directory file read-only and, well,
 |> reading from it), so the `opendir`/`readdir`/`closedir` interfaces
 |> were added to hide this in the kernel and mimic the more traditional
 |> open/read/close loop.
 |
 |And then we had to wait until POSIX.1-2024 until the "old" interface
 |became standardized (which is useful because opendir doesn't let you
 |specify buffer size).

And with the (yet only "encouraged") DT_FORCE_TYPE flag for

 |https://pubs.opengroup.org/onlinepubs/9799919799/functions/posix_getdent\
 |s.html

a painful, racy / unsafe programming could finally iterate out.
Just last week, due to a thread on a FreeBSD list i read, i
looked into an implementation that is the quarter of a century
old; it contains several (preprocessor conditionalized) code
paths, dependend upon availability of certain *at() series
functions (not to talk about ENOSYS handling, which is done
badly), and it was a pain, and very unsafe.  No, it effectively
is broken to create absolute (real)paths and/or chdir()
(multi-threading was a thing, that is locked..) for querying
file statuses.
Hoping for this.  (And posix_devctl() instead of ioctl(), though
i think .. the Unix world becomes somewhat easy, anyhow.)

Plan9port that is talked about here at the moment went into
the other direction five years ago, and dropped all the getdents /
getdirentries (maybe) shims to end up only with opendir.
'Thing was also that opendir() stuff performs allocations, and
thus sucks in the entire memory cache layer, and that sucks in
threading stuff ...  All that does no longer matter with all the
init, fini etc sections, ifunc's, TLS (ThreadSpecificData), of
modern times.  Of course.

P.S.: i would at least remove the defunct header fields if you do
not want to fix it, Warren.  Isn't that nothing more than a sed(1)
invocation?  It is so .. an ugly alien spot, and it cannot even be
healed with tea tree oil.  (Sigh.)

--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)


More information about the TUHS mailing list