In response to the e-mail discussion of this case, I am submitting this revised specification:
futimens, utimensat 1. Introduction This case adds two new functions to the C library, futimens() and utimensat(), as follows: #include <sys/stat.h> int futimens(int fd, const struct timespec times[2]); int utimensat(int fd, const char *path, const struct timespec times[2], int flag); In addition, in order to query the timestamp resolution for a given file or directory, fpathconf() and pathconf() will be extended to accept a new name, _PC_TIMESTAMP_RESOLUTION, defined in <unistd.h>. The return value of fpathconf() and pathconf() in this case will be a number in the range 1 to 1000 million, indicating the number of nanoseconds of the file's timestamp resolution. Each local file system will be made to understand this new VOP_PATHCONF operation and return the appropriate value. Finally, the touch(1) utility will be updated to use the new interfaces and to provide a date_time specification that includes up to nanosecond resolution. The commitment level of these interfaces is Committed. The release binding is "patch" (so it can be back-ported to Solaris 10 if required). 2. Discussion Problems with, for example, make on ZFS file systems have emerged because ZFS keeps access and modification times for its files with nanosecond granularity, while commands such as touch(1) will only set access and modification times of its target files to microsecond granularity (rounded down). See the bugid: 6539657 touch(1) does not set the nanosecond timestamp of a file correctly The touch(1) command (and possibly others) need a system call interface that sets access and modification times of files with nanosecond granularity. Happily, such interfaces have been designed and are specified in the latest SUSv4 Posix interface specification: #include <sys/stat.h> int futimens(int fd, const struct timespec times[2]); int utimensat(int fd, const char *path, const struct timespec times[2], int flag); Even though Solaris does not (yet) implement the new Posix standard, there is nothing stopping Solaris from providing a few of the newly-specified interfaces (provided that the names are appropriately hidden from view when an old standards-conforming application is compiled). 3. Interface table The futimens() and utimensat() functions are Committed. Both are specified by the latest Posix specification. The fpathconf() name _PC_TIMESTAMP_RESOLUTION and operation are Committed and are specified by the latest Posix specification. The updated touch(1) command line interface is Committed and is specified by the latest Posix specification. 4. References 6815302 Implement futimens, utimensat(POSIX.1-2008) - set file modification times with nanosecond granularity 5. Manual pages. See the materials directory for the new futimens(2) manual page. This is copied from the Posix specification, with minor changes such as changing "shall" to "will" in the text. See the subdirectories 'oldman' and 'newman' under the materials directory to view the old and new manual pages for getconf.1 touch.1 pathconf.2 utime.2 utimes.2 stat.h.3head unistd.h.3head The 'newman' files contain modifications reflecting the changes described in this proposal. Use 'diff' to view the differences between the old and new manual pages. Roger Faulkner