* Typo in stat(2)
@ 2020-09-30 12:07 Christoph Kalchreuter
2020-09-30 12:22 ` Florian Weimer
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Kalchreuter @ 2020-09-30 12:07 UTC (permalink / raw)
To: mtk.manpages; +Cc: linux-man
Hello,
I'm under the impression that I found three typing errors in stat(2).
Used distribution: "Ubuntu 18.04.5 LTS"
Also appears in: "https://man7.org/linux/man-pages/man2/stat.2.html"
There are three Letters "e" missing in Section "DESCRIPTION", Subsection "The
stat structure":
struct timespec st_atim; /* Time of last access */
struct timespec st_mtim; /* Time of last modification */
sruct timespec st_ctim; /* Time of last status change */
should possibly be:
struct timespec st_atime; /* Time of last access */
struct timespec st_mtime; /* Time of last modification */
sruct timespec st_ctime; /* Time of last status change */
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Typo in stat(2)
2020-09-30 12:07 Typo in stat(2) Christoph Kalchreuter
@ 2020-09-30 12:22 ` Florian Weimer
2020-09-30 19:38 ` Michael Kerrisk (man-pages)
0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2020-09-30 12:22 UTC (permalink / raw)
To: Christoph Kalchreuter; +Cc: mtk.manpages, linux-man
* Christoph Kalchreuter:
> There are three Letters "e" missing in Section "DESCRIPTION",
> Subsection "The stat structure":
>
> struct timespec st_atim; /* Time of last access */
> struct timespec st_mtim; /* Time of last modification */
> sruct timespec st_ctim; /* Time of last status change */
>
> should possibly be:
>
> struct timespec st_atime; /* Time of last access */
> struct timespec st_mtime; /* Time of last modification */
> sruct timespec st_ctime; /* Time of last status change */
This typo is also present in POSIX, so we cannot change it (like the
creat function).
Thanks,
Florian
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Typo in stat(2)
2020-09-30 12:22 ` Florian Weimer
@ 2020-09-30 19:38 ` Michael Kerrisk (man-pages)
2020-10-01 6:20 ` Christoph Kalchreuter
0 siblings, 1 reply; 5+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-09-30 19:38 UTC (permalink / raw)
To: Florian Weimer, Christoph Kalchreuter; +Cc: mtk.manpages, linux-man
On 9/30/20 2:22 PM, Florian Weimer wrote:
> * Christoph Kalchreuter:
>
>> There are three Letters "e" missing in Section "DESCRIPTION",
>> Subsection "The stat structure":
>>
>> struct timespec st_atim; /* Time of last access */
>> struct timespec st_mtim; /* Time of last modification */
>> sruct timespec st_ctim; /* Time of last status change */
>>
>> should possibly be:
>>
>> struct timespec st_atime; /* Time of last access */
>> struct timespec st_mtime; /* Time of last modification */
>> sruct timespec st_ctime; /* Time of last status change */
>
> This typo is also present in POSIX, so we cannot change it (like the
> creat function).
Hi Christoph,
Florian was being very deadpan in his humor! The names
really are correct. In the header files, one can find
[[ # /usr/include/bits/stat.h
struct timespec st_atim; /* Time of last access. */
struct timespec st_mtim; /* Time of last modification. */
struct timespec st_ctim; /* Time of last status change. */
# define st_atime st_atim.tv_sec /* Backward compatibility. */
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
]]
And struct timespec is defined as
struct timespec {
time_t tv_sec; /* Seconds */
long tv_nsec; /* Nanoseconds */
};
Thanks,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Typo in stat(2)
2020-09-30 19:38 ` Michael Kerrisk (man-pages)
@ 2020-10-01 6:20 ` Christoph Kalchreuter
2020-10-01 9:22 ` Jakub Wilk
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Kalchreuter @ 2020-10-01 6:20 UTC (permalink / raw)
To: Michael Kerrisk (man-pages), Florian Weimer; +Cc: linux-man
Hi Michael,
you're right, st_ctim is in struct stat if it's read via lstat and I missed the
NOTES-section where it's clearly stated ("The nanosecond components of each
timestamp are available via names of the form st_atim.tv_nsec").
I originally came from nftw(3) where I concluded from the sentence "sb is a
pointer to the stat structure returned by a call to stat(2) for fpath." that I
can find the description for struct stat in stat(2).
In stat(2) I found that "struct timespec st_mtim" exists in struct stat, so I
tried to read st_mtim.tv_sec from struct stat that nftw returned.
But the compiler complained: "‘const struct stat’ has no member named ‘st_mtim’;
did you mean ‘st_mtime’" and I concluded that there is no st_mtim in struct stat
and as there isn't any description of st_atim, st_mtim and st_ctim in the
explanation "The fields in the stat structure are as follows:" I assumed that
it's an typing error in the manual.
It isn't and I surely did something wrong somewhere (I've to admit that I'm not
that experienced programmer).
So, sorry for false alarm.
Best,
Christoph
On 9/30/20 9:38 PM, Michael Kerrisk (man-pages) wrote:
> On 9/30/20 2:22 PM, Florian Weimer wrote:
>> * Christoph Kalchreuter:
>>
>>> There are three Letters "e" missing in Section "DESCRIPTION",
>>> Subsection "The stat structure":
>>>
>>> struct timespec st_atim; /* Time of last access */
>>> struct timespec st_mtim; /* Time of last modification */
>>> sruct timespec st_ctim; /* Time of last status change */
>>>
>>> should possibly be:
>>>
>>> struct timespec st_atime; /* Time of last access */
>>> struct timespec st_mtime; /* Time of last modification */
>>> sruct timespec st_ctime; /* Time of last status change */
>>
>> This typo is also present in POSIX, so we cannot change it (like the
>> creat function).
>
> Hi Christoph,
>
> Florian was being very deadpan in his humor! The names
> really are correct. In the header files, one can find
>
> [[ # /usr/include/bits/stat.h
>
> struct timespec st_atim; /* Time of last access. */
> struct timespec st_mtim; /* Time of last modification. */
> struct timespec st_ctim; /* Time of last status change. */
> # define st_atime st_atim.tv_sec /* Backward compatibility. */
> # define st_mtime st_mtim.tv_sec
> # define st_ctime st_ctim.tv_sec
> ]]
>
> And struct timespec is defined as
>
> struct timespec {
> time_t tv_sec; /* Seconds */
> long tv_nsec; /* Nanoseconds */
> };
>
>
> Thanks,
>
> Michael
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Typo in stat(2)
2020-10-01 6:20 ` Christoph Kalchreuter
@ 2020-10-01 9:22 ` Jakub Wilk
0 siblings, 0 replies; 5+ messages in thread
From: Jakub Wilk @ 2020-10-01 9:22 UTC (permalink / raw)
To: Christoph Kalchreuter; +Cc: linux-man
* Christoph Kalchreuter <christoph@kalchreuter.de>, 2020-10-01, 08:20:
>But the compiler complained: "‘const struct stat’ has no member named
>‘st_mtim’
glibc doesn't always expose the st_mtim member (see the NOTES section
for details), but it should be available by default.
Did you use any compiler options, or define any feature test macros?
--
Jakub Wilk
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-01 9:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30 12:07 Typo in stat(2) Christoph Kalchreuter
2020-09-30 12:22 ` Florian Weimer
2020-09-30 19:38 ` Michael Kerrisk (man-pages)
2020-10-01 6:20 ` Christoph Kalchreuter
2020-10-01 9:22 ` Jakub Wilk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.