performance problems

Corinna Vinschen
Mon Jun 6 12:13:00 GMT 2005

On Jun  6 11:31, Corinna Vinschen wrote:
> On Jun  2 18:32, Brian Dessent wrote:
> > In order to implement stat(), cygwin has to call NtQueryInformationFile
> > (GetFileInformationByHandle for 9x/me) and this requires the file to be
> > opened.  Thus the reason that stat takes forever is that each file has
> There would be a theoretical way around this.  NtQueryDirectoryFile allows
> to get all information about a file (with a prominent exception) without
> having to open the file.  Instead you just need the handle to the parent
> directory.  We don't have the infrastructure in Cygwin right now to use
> this method easily, but it could speed up stat when, for instance, the file
> is in the current working directory or if the process has called opendir on
> the parent directory of the file.

Further testing of the NtQueryDirectoryFile function shows that it's not
usable as I imagined.  If you want to retrieve information about a single
file without disturbing the current opendir/readdir, it's necessary to
open the directory again.  The directory handle used in the current
opendir/readdir is not usable for this purpose.  Neither is a duplicated
handle of it.  Oh boy.

Looks like the only useful way to use it is caching the results.  As far
as that's useful.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader
Red Hat, Inc.

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list