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


-----BEGIN PGP SIGNED MESSAGE-----
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             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqdxfwACgkQ84KuGfSFAYC25wCgukOyTo5JpQ5c1wMk2HhpcJtD
MrUAn2qUnrv2+w4SsGjf6BKzjawc6ndA
=q8gE
-----END PGP SIGNATURE-----

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


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