This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: readdir.c: d_off instead of d_reclen [PATCH]


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 <sjackman@gmail.com> wrote:
> The getdents(2) manual page indicates d_off should be used as the
> offset to the next dirent.
> 
> Cheers,
> Shaun


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]