[Patch] Add dirent.d_type support to Cygwin 1.7 ?

Christian Franke Christian.Franke@t-online.de
Thu Nov 27 21:43:00 GMT 2008


Corinna Vinschen wrote:
> The logic sounds ok to me.  I just don't think we need a warning 
> and the condition could be simplified accordingly.
>
>   

New patch below. Conditionals removed as suggested by cgf.

Define of _DIRENT_HAVE_D_TYPE still there - google code search finds 
several projects using this instead of a ./configure check.


2008-11-27  Christian Franke  <franke@computer.org>

	* dir.cc (readdir_worker): Initialize dirent.d_type and __d_unused1.
	* fhandler_disk_file.cc (fhandler_disk_file::readdir_helper):
	Set dirent.d_type based on FILE_ATTRIBUTE_*.
	* include/sys/dirent.h: Define _DIRENT_HAVE_D_TYPE.
	(struct dirent): Add d_type. Adjust __d_unused1 size to preserve layout.
	[_DIRENT_HAVE_D_TYPE]: Enable DT_* declarations.



Christian


PS: find is not as smart as expected: 'find /path -type d' calls lstat() 
for each entry, even if d_type != DT_UNKNOWN.
So 'find /path' is 2-3 times faster than 'find /path -type d'.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-dirent-d_type-2.patch
Type: text/x-patch
Size: 2974 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20081127/195dafb0/attachment.bin>


More information about the Cygwin-patches mailing list