RFR: 8343417: (fs) BasicFileAttributeView.setTimes uses microsecond precision with NOFOLLOW_LINKS

Alan Bateman alanb at openjdk.org
Tue Nov 5 12:07:29 UTC 2024


On Mon, 4 Nov 2024 19:30:11 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Add support for setting the last access and last modification times of symbolic links with nanosecond precision on Linux where the system call `utimensat(2)` is available.

src/java.base/unix/classes/sun/nio/fs/UnixNativeDispatcher.java line 400:

> 398:      * We hard code fd to FD_ATCWD and flags to AT_SYMLINK_NOFOLLOW.
> 399:      */
> 400:     static void utimensat(UnixPath path, long times0, long times1)

The *at methods that are supposed to map 1-1 to the similarly named sys calls so I'm a bit uncomfortable having this one work differently and hardcode dirfd  to FD_ATCWD. I wonder if we could generate a value for FD_ATCWD in UnixConstants.java.template so that the use site would more closely match the sys call.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21886#discussion_r1829236119


More information about the nio-dev mailing list