This is the mail archive of the cygwin mailing list for the Cygwin 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: struct dirent.d_reclen

Hash: SHA1

According to Christopher Faylor on 9/1/2009 5:37 PM:
> Maybe you mean d_namlen?

Yes; serves me right for confusing readdir(2) and readdir(3) man pages.

> 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.

Not so.  For example, fhandler_disk_file::readdir_helper is already doing
a sys_wcstombs to populate the d_name buffer, and that returns the length
as a side effect.  In other words, the cost of providing the length to the
client is an O(1) single assignment of an already-existing value per entry
(and when you consider that we are already assigning __d_unused1 to 0,
that means no net increase in cost to clients that don't care about the
length); whereas the current situation requires clients that care about
the length to use O(n) strlen() and duplicate something that was
previously calculated by cygwin1.dll.

- --
Don't work too hard, make some time for fun as well!

Eric Blake   
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


Problem reports:
Unsubscribe info:

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