readdir.c: d_off instead of d_reclen [PATCH]

Shaun Jackman
Fri Jun 3 19:30:00 GMT 2005

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

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.


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.
> Cheers,
> Shaun

More information about the Newlib mailing list