Defect report from : Paul Eggert , UCLA
(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
@ page 360 line 12713 section sys/stat.h objection {20060611a}
Problem:
Edition of Specification (Year): 2004
Defect code : 2. Omission
This Aardvark follows up to XSH ERN 138 (Defect in XSH utimes). It
addresses only the changes to struct stat, since they are common
practice now. I would like to split off into a separate Aardvark my
suggestion about the new system call to set file times, since any such
call will be a committee invention at this point. I would also like
to add an Aardvark to add to the 'touch' command the ability to set
subsecond timestamps; this is existing practice. There is other stuff
that I'd like to see (e.g., Garrett Wollman's suggestion of a pathconf
key that returns a clock number, which we can interrogate for
timestamp resolution), but we (or at least I :-) don't have enough
experience for this so I left it out for now.
This Aardvark refines the suggestion in XSH ERN 138 along the lines of
the subsequent discussion in austin-group-l. I am especially indebted
to Glen Fowler's remarks of 2006-03-07, and have attempted to propose
a spec that addresses his points.
Action:
Unless otherwise specified, change all occurrences of st_atime to
st_atim, st_ctime to st_ctim, and st_mtime to st_mtim. These new
struct stat fields specify both seconds and nanoseconds part of file
timestamps. For example, this change affects XBD page 98 lines
3075-3077,
After XBD page 99 line 3093 insert:
The resolution of timestamps of files in a file system is
implementation-defined, but shall be no coarser than one-second
resolution. The st_atim, st_ctim, and st_mtim fields shall always
have values that are supported by the file system. Whenever a
file's st_atim, st_ctim, or st_mtim field is to be set to a value V
according to the rules of the preceding paragraphs of this section,
the implementation shall immediately set the field to the greatest
value supported by the file system that is not greater than V.
After XBD page 360 line 12713 insert:
struct timespec st_atim Time of last access
After line 12714 insert:
struct timespec st_mtim Time of last data modification
After line 12715 insert:
struct timespec st_ctim Time of last status change
Change lines 12723-12724 from:
The timespec structure may be defined as described in <time.h>.
to:
The timespec structure shall be defined as described in <time.h>.
After line 12733 add:
The st_atime field shall be an alias for the st_atim.tm_sec field.
It is implementation-defined whether this aliasing is via a macro
(e.g., "#define st_atime st_atim.tv_sec") or by other means.
Similarly, st_ctime shall be an alias for st_ctim.tm_sec, and
st_mtime for st_mtim.tm_sec.
After page 363 line 12818 add:
When a file timestamp is converted to file system resolution, it may
decrease by a nonnegative value that is less than the file system
resolution. This action must occur immediately, and must not be
visible to applications. For example, if the file system resolution
is 1 microsecond, then a conforming stat() must always return an
st_mtim.tv_nsec that is a multiple of 1000. Some older
implementations returned higher-resolution time stamps while the
inode information was cached, and then spontaneously truncated the
tv_nsec fields when they were stored to and retrieved from disk, but
this behavior does not conform.
|