Subject: Re: EISDIR on directory read(2)
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 10/11/1999 02:53:57
> I'd like to go down on the record as disagreeing with returning
> EISDIR on directory read(2)
Me too, at least when the directory is local.
I'm really writing to respond to
> Locally, opendir(3) and readdir(3) are just magic wrappers around
> open(2) and read(2).
Are they? I thought they were wrappers around getdents(). That's
certainly what the code in lib/libc/gen/ looks like to me.
> To me, as a programmer, this makes perfect sense. getdents(2)
> *almost* strikes me as more of a hack than opendir(3) and readdir(3).
> Almost.
getdents is really necessary to present a uniform view of directory
entries across multiple filesystem types; userland code - even libc -
cannot be expected to know all about all possible directory formats,
especially remote ones on foreign OSes - VMS, for example.
> If you're going to return EISDIR, wouldn't you be doing that on the
> open(2), not the read(2)?
Yes...except that then we need a "open for fchdir/fstat/etc" method of
some sort.
> "If it ain't broke, don't fix it."
Quite.
der Mouse
mouse@rodents.montreal.qc.ca
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B