This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
stat matters
- From: "Pierre A. Humblet" <Pierre dot Humblet at ieee dot org>
- To: cygwin-developers at cygwin dot com
- Date: Tue, 27 May 2003 19:48:43 -0400
- Subject: stat matters
Here are three remarks about stat
1) Yesterday there was a discussion in cygwin_patches about the use of
strlen()
in fstat_by_name.
The good news is that we can use strcmp(a, b) <= 0 after all, because in
our
case a is a prefix of b, or b is a prefix of a.
The bad news is that one old bug still isn't taken care of: "c:/." is
a root dir without being a prefix of "c:/".
So I suggest a more radical approach: do not check for root dir at all but
whenever FindFirstFile fails with winerror 2 (although we know the
file did exist a few ms ago and we have its attributes), call fstat_helper
with zero dates and lengths.
2) There is a comment in fhandler_disk_file::fstat to the effect that a
"query open" is much faster than a normal open.
So, why don't we do a query open when possible, i.e. also for dirs,
sockets,
symlinks, and more importantly, whenever has_acls(), ntsec and
wincap.has_security () are true?
3) GetCompressedFileSize does not always report the updated size between the
moment where a write occurs and the moment where the buffers are flushed to
disk. It can underreport the value of st_blocks, but it's not clear if this
violates POSIX:
blkcnt_t st_blocks number of blocks allocated for this object
Allocated where? The blocks won't be on disk until flushed.
Pierre