This is the mail archive of the
mailing list for the Cygwin project.
Re: struct dirent.d_reclen
- From: Christopher Faylor <cgf-use-the-mailinglist-please at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 1 Sep 2009 19:37:50 -0400
- Subject: Re: struct dirent.d_reclen
- References: <loom.20090901T193145email@example.com>
- Reply-to: cygwin at cygwin dot com
On Tue, Sep 01, 2009 at 05:39:02PM +0000, Eric Blake wrote:
>Wish list (probably post 7.1): As long as we are making struct dirent more like
>Linux with the recent addition of d_type, we should probably also burn two of
>the remaining 3 __d_unused1 bytes to declare unsigned short d_reclen, whose
>value is always strlen(d_name), so that applications could get by with fewer
>strlen calls. Coreutils ls would certainly benefit from this optimization.
Defining d_*rec*len as strlen(d_name) would not be correct since that is
supposed to be the length of the record not the name. That's why linux
has macros that look like this:
# define _D_ALLOC_NAMLEN(d) (((char *) (d) + (d)->d_reclen) - &(d)->d_name)
Maybe you mean d_namlen?
It is not a given that adding d_reclen would speed anything up since it
cause every single program that uses dirent to effectively perform a
strlen on every record returned by readdir whether it needed that field
or not. Making sure that field was filled out would also complicate
Cygwin's internal logic.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple