public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygwin /usr/bin/stat returns "Birth: -", which value in FILE_BASIC_INFORMATION.CreationTime causes that?
@ 2024-04-05  0:05 Martin Wege
  2024-04-05  0:54 ` Brian Inglis
  2024-04-05  2:26 ` 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 '-'? Martin Wege
  0 siblings, 2 replies; 8+ messages in thread
From: Martin Wege @ 2024-04-05  0:05 UTC (permalink / raw)
  To: cygwin

Hello,

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?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin /usr/bin/stat returns "Birth: -", which value in FILE_BASIC_INFORMATION.CreationTime causes that?
  2024-04-05  0:05 Cygwin /usr/bin/stat returns "Birth: -", which value in FILE_BASIC_INFORMATION.CreationTime causes that? Martin Wege
@ 2024-04-05  0:54 ` Brian Inglis
  2024-04-05  1:08   ` Martin Wege
  2024-04-05  2:26 ` 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 '-'? Martin Wege
  1 sibling, 1 reply; 8+ messages in thread
From: Brian Inglis @ 2024-04-05  0:54 UTC (permalink / raw)
  To: cygwin

On 2024-04-04 18:05, Martin Wege via Cygwin 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?

https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/stat.c#n1618

=> tv_nsec < 0

https://cygwin.com/git?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/fhandler/disk_file.cc#l414

https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/times.cc#l283

-- 
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin /usr/bin/stat returns "Birth: -", which value in FILE_BASIC_INFORMATION.CreationTime causes that?
  2024-04-05  0:54 ` Brian Inglis
@ 2024-04-05  1:08   ` Martin Wege
  2024-04-05 15:51     ` Brian Inglis
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Wege @ 2024-04-05  1:08 UTC (permalink / raw)
  To: cygwin

On Fri, Apr 5, 2024 at 2:55 AM Brian Inglis via Cygwin
<cygwin@cygwin.com> wrote:
>
> On 2024-04-04 18:05, Martin Wege via Cygwin 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?
>
> https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/stat.c#n1618
>
> => tv_nsec < 0
>
> https://cygwin.com/git?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/fhandler/disk_file.cc#l414
>
> https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/times.cc#l283

Thank you

But how can tv_nsec become negative (tv_nsec < 0)? That can only
happen if BasicInformation.CreationTime.QuadPart is negative, right?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* 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 '-'?
  2024-04-05  0:05 Cygwin /usr/bin/stat returns "Birth: -", which value in FILE_BASIC_INFORMATION.CreationTime causes that? Martin Wege
  2024-04-05  0:54 ` Brian Inglis
@ 2024-04-05  2:26 ` Martin Wege
  2024-04-09 21:14   ` Corinna Vinschen
  1 sibling, 1 reply; 8+ messages in thread
From: Martin Wege @ 2024-04-05  2:26 UTC (permalink / raw)
  To: cygwin

On Fri, Apr 5, 2024 at 2:05 AM Martin Wege <martin.l.wege@gmail.com> wrote:
>
> Hello,
>
> 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?

Thanks,
Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cygwin /usr/bin/stat returns "Birth: -", which value in FILE_BASIC_INFORMATION.CreationTime causes that?
  2024-04-05  1:08   ` Martin Wege
@ 2024-04-05 15:51     ` Brian Inglis
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Inglis @ 2024-04-05 15:51 UTC (permalink / raw)
  To: cygwin

On 2024-04-04 19:08, Martin Wege via Cygwin wrote:
> On Fri, Apr 5, 2024 at 2:55 AM Brian Inglis via Cygwin
> <cygwin@cygwin.com> wrote:
>>
>> On 2024-04-04 18:05, Martin Wege via Cygwin 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?
>>
>> https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/stat.c#n1618
>>
>> => tv_nsec < 0
>>
>> https://cygwin.com/git?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/fhandler/disk_file.cc#l414
>>
>> https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/times.cc#l283
> 
> Thank you
> 
> But how can tv_nsec become negative (tv_nsec < 0)? That can only
> happen if BasicInformation.CreationTime.QuadPart is negative, right?

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

-- 
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 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 '-'?
  2024-04-05  2:26 ` 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 '-'? Martin Wege
@ 2024-04-09 21:14   ` Corinna Vinschen
  2024-04-10  4:30     ` Brian Inglis
  0 siblings, 1 reply; 8+ messages in thread
From: Corinna Vinschen @ 2024-04-09 21:14 UTC (permalink / raw)
  To: cygwin

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:
> >
> > Hello,
> >
> > 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.

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.

But the FS driver can also just fill the CreationTime field with the
same value as LastWriteTime or ChangeTime.  MSFT NFS does that.


Corinna

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 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 '-'?
  2024-04-09 21:14   ` Corinna Vinschen
@ 2024-04-10  4:30     ` Brian Inglis
  2024-04-10  7:59       ` Corinna Vinschen
  0 siblings, 1 reply; 8+ messages in thread
From: Brian Inglis @ 2024-04-10  4:30 UTC (permalink / raw)
  To: cygwin

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 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 '-'?
  2024-04-10  4:30     ` Brian Inglis
@ 2024-04-10  7:59       ` Corinna Vinschen
  0 siblings, 0 replies; 8+ messages in thread
From: Corinna Vinschen @ 2024-04-10  7:59 UTC (permalink / raw)
  To: cygwin

On Apr  9 22:30, Brian Inglis via Cygwin wrote:
> 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?

Oh yes, that makes sense, CDFS and the likes of them.

> > 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

I'm aware of that.  This remarks session is copy/pasted in other MSFT
articles, too.  But it doesn't really answer Martin's question.

It describes what a consumer (application or driver) is supposed to set
the timestamps to when passing timestamps to a filesystem driver via
ZwSetInformationFile (or its friends on the lower OS levels).

It does *not* describe the other direction of the call stack, i. e.,
what a filesystem driver is supposed to set a timestamp to, if its
underlying filesystem doesn't support this kind of timestamp.

And that's the direction Martin is asking about.


Corinna

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-10  7:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-05  0:05 Cygwin /usr/bin/stat returns "Birth: -", which value in FILE_BASIC_INFORMATION.CreationTime causes that? Martin Wege
2024-04-05  0:54 ` Brian Inglis
2024-04-05  1:08   ` Martin Wege
2024-04-05 15:51     ` Brian Inglis
2024-04-05  2:26 ` 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 '-'? Martin Wege
2024-04-09 21:14   ` Corinna Vinschen
2024-04-10  4:30     ` Brian Inglis
2024-04-10  7:59       ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).