Subject: Re: problem with tmpfs and linux emulation?
To: YAMAMOTO Takashi <>
From: Thor Lancelot Simon <>
List: current-users
Date: 11/12/2005 17:35:41
On Sun, Nov 13, 2005 at 06:17:19AM +0900, YAMAMOTO Takashi wrote:
> > > Linux libc doesn't use read(2) to read directories, it uses
> > > getdents64().
> > 
> > "It depends".  There were discussions on linux kernel lists as little
> > as a year ago about how it would be _nice_ to be able to assume that
> > libc always used getdents64() to avoid supporting lseek() on directories.
> > 
> > Thor
> are you sure?
> iirc, linux doesn't support read(2) on directories, even for ext2.

No, it looks like I was mistaken.  I seem to have misunderstood a
discussion of glibc mixing together calls to getdents and getdents64
which resulted in calling lseek with invalid offsets that the kernel
tried to translate in some complicated way.

I've definitely debugged a version of libc that used read on directories
but it could have been as long as 10 years ago, now that I think of it.