This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [PATCH] Linux: Add <sys/direntries.h>


* Adhemerval Zanella:

> Probably not many, even now you see on debian sparc maillist programs
> that raise alignment issue due sparc restrictions. But masking wrong C
> usage is not intention of such interfaces.

I think code that's difficult to implement in a portable fashion may
have a place in glibc, particularly if it is closely related to a glibc
or kernel interface.

>> To support 64-bit directory offsets on 32-bit architectures, readdir and
>> readdir64 must call malloc after all previous telldir call, to allocate
>> space for the 64-to-32 mapping.  telldir cannot report failure and
>> therefore cannot call malloc.  So extending opendir in this way looks
>> rather problematic.
>
> I think you meant seekdir instead of telldir.

No, I meant telldir.  telldir needs space to store a new mapping if it
is called (which we do not know beforehand).  We can preallocate a fixed
number of entries (one is quite enough), but if telldir has been called,
and *then* readdir is called, we need to make sure that we have space
for another mapping if telldir is called again.

This is the proper fix for bug 23960 and is what FreeBSD does.

Thanks,
Florian


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