Re: dirent

H.J. Lu (hjl@nynexst.com)
Sun, 25 Jun 95 15:55:44 EDT


>
> H.J. Lu once wrote:
> > >
> > > Hi,
> > >
> > > Is there any plan to support correct and separate d_reclen and d_namlen in
> > > struct dirent in future? It appears that currently readdir() returns d_reclen
> > > that is useless to a user - a size of structure aligned to a 4-byte boundary
> > > (?). I think on most other system it's EXACT structure size. d_namlen is
> > > probably used by a lot of GNU and BSD programs. Other systems I have seen have
> > > both reclen and namlen.
> > >
> > > It was my impression that under linux 1.2 and libc 5.0.x d_reclen was actually
> > > set to strlen(dir -> d_name). If so, shouldn't it be just renamed to d_namlen
> > > instead of having to recompile and patch make and other existing binaries?
> > >
> >
> > That is a system call, readdir, old/getdents, new. I only takes
> > whatever returned from the kernel. The current dirent is the
>
> Meaning that now libc returns different d_reclen when running under v1.2 and

The old libc only gets one dirent entry at a time. For
whatever reason, the bogus code like make can live with
that.

> v1.3? And if I compile make under v1.3 users running v1.2 won't be able to
> run it. How about compatibility between libc 5.0.x and libc 5.1.x?

That is a bug in make, not in libc. I don't wany to keep
buggy compatibility :-(.

> Well, but how about POSIX, Hurd or BSD 4.4?
>

Linux follows POSIX.

-- 
H.J. Lu
NYNEX Science and Technology, Inc.			hjl@nynexst.com