Re: struct dirent in Linux 2.0

Ulrich Windl (ulrich.windl@rz.uni-regensburg.de)
Tue, 18 Feb 1997 08:24:54 +0100


On 17 Feb 97 at 12:30, Aaron M. Ucko wrote:

> Ulrich Windl <windl@pc5234.dvm.klinik.uni-regensburg.de> writes:
>
> > I've found the following definition for struct dirent members:
> >
> > char d_name[MAXNAMLEN+1]; /* name of directory entry */
> > ino_t d_ino; /* file serial number */
> > short d_namlen; /* length of string in d_name */
> > short d_reclen; /* length of this record */
> >
> > Unfortunately Linux currently defines just
> >
> > long d_ino;
> > __kernel_off_t d_off;
> > unsigned short d_reclen;
> > char d_name[256]; /* We must not include limits.h! */
> >
> > I don't have the POSIX specs, but the first one claims to be POSIX. Can
> > Linux have a d_namlen, too?
>
> The first is definitely not POSIX. *All* POSIX specifies about struct
> dirent is that it contain d_name.

At least they should specify the zero-termination property of
d_name, too. Despite of that the HP-UX manual page on dirent(5)
claims that the above structure conforms to AES, SVID2, SVID3, XPG2,
XPG3, XPG4, FIPS 151-2, POSIX.1 -- Now what about Linux?

Ulrich

>
> --
> Aaron M. Ucko (amu@mit.edu) | For Geek Code, PGP public key, and other info,
> finger amu@monk.mit.edu. | "Kids! Bringing about Armageddon can be dangerous.
> Do not attempt it in your home." -- T. Pratchett & N. Gaiman, _Good Omens_
>