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. I'm not sure, but it could perhaps even get rid of the annoying messages ls: hiberfil.sys: No such file or directory ls: pagefile.sys: No such file or directory when calling `ls -l' in /cygdrive/c. Uh, yes, the prominent exception... unfortunately, there's no way to use NtQueryDirectoryFile on NT4 and W2K to retrieve the file id (inode number). This has been introduced with XP and 2K3 first. Too bad. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin@cygwin.com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/