Win32 FILE_BASIC_INFORMATION.*Time.QuadPart - which value should be used if filesystem does not support it, so Cygwin /usr/bin/stat lists the value as '-'?

Brian Inglis Brian.Inglis@SystematicSW.ab.ca
Wed Apr 10 04:30:07 GMT 2024


On 2024-04-09 15:14, Corinna Vinschen via Cygwin wrote:
> On Apr  5 04:26, Martin Wege via Cygwin wrote:
>> On Fri, Apr 5, 2024 at 2:05 AM Martin Wege <martin.l.wege@gmail.com> wrote:
>>> I have problems with debugging, so a quick help would be appreciated,
>>> as I cannot figure this out after several hours of digging.
>>>
>>> Cygwin /usr/bin/stat returns "Birth: -" for some files. Which value
>>> must the CreationTime member of FILE_BASIC_INFORMATION have to cause
>>> /usr/bin/stat ti return "-"? 0, -1, or something else?
>>
>> In a related matter:
>> The Win32 FILE_BASIC_INFORMATION structure defines four time values:
>>
>> LARGE_INTEGER CreationTime;
>> LARGE_INTEGER LastAccessTime;
>> LARGE_INTEGER LastWriteTime;
>> LARGE_INTEGER ChangeTime;
>>
>> How can a filesystem indicate if it does not support a particular
>> timestamp, such as ChangeTime? Should ChangeTime.QuadPart then be -1,
>> -2 or 0, or another value?
> 
> I'm not aware of a filesystem not supporting ChangeTime, that is,
> st_ctime.  Usually only CreationTime (st_birthtime) is missing.

R/O media like CD/DVD-R or FS w/o write support?

> I think setting the timestamp to 0 works for indicating that this kind
> of timestamp is not supported.  Cygwin is handling Windows timestamps
> this way, but I can't find this in documentation ATM.

See upthread?:

Caller or application can set 0 to mean keep/return current value, caller or 
driver can set -1 to mean don't update/return current value:

https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_file_basic_information#remarks

> But the FS driver can also just fill the CreationTime field with the
> same value as LastWriteTime or ChangeTime.  MSFT NFS does that.
-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry



More information about the Cygwin mailing list