readdir.c: d_off instead of d_reclen [PATCH]

Jeff Johnston
Fri Jun 3 19:35:00 GMT 2005

Shaun Jackman wrote:
> I retract this patch. Although the non-Linux kernel I was inspecting
> uses d_off as I described in the patch, the Linux kernel clearly does
> not. Some experimentation shows that d_off is an absolute offset and
> not relative to the current record. Frustratingly, it does not appear
> to reflect the data returned by getdents at all. It must be used
> internally to the kernel, perhaps reflecting the way the data is
> stored on disk. I do not understand why the kernel would massage the
> data so much moving it from disk to user space, but it appears to
> shuffle the records around leaving gaps between the records and
> updating d_reclen to reflect the gaps, but the kernel does not update
> d_off.
> If someone has an explanation as to what mischief the Linux kernel's
> getting up to here, I'd be very interested in hearing it.
> Cheers,
> Shaun
> On 6/3/05, Shaun Jackman <> wrote:
>>The getdents(2) manual page indicates d_off should be used as the
>>offset to the next dirent.
> n

I didn't see this when I just sent a response to your previous note.  I guess I 
retract that as well :)

-- Jeff J.

More information about the Newlib mailing list