RFR: 8343785: (fs) Remove syscalls that set file times with microsecond precision

Alan Bateman alanb at openjdk.org
Sat Nov 9 08:56:18 UTC 2024


On Fri, 8 Nov 2024 16:18:55 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Remove the syscalls `utimes`, `futimes`, and `lutimes` that set the file access and modification times using microsecond precision.

src/java.base/macosx/classes/sun/nio/fs/BsdFileAttributeViews.java line 59:

> 57:             if (lastModifiedTime == null || lastAccessTime == null) {
> 58:                 try {
> 59:                     UnixFileAttributes attrs = UnixFileAttributes.get(path, followLinks);

We should use openForAttributeAccess if possible. If lastModifiedTime or lastAccessTime is not provided then it ensures that this method will only access one file to avoid racing with concurrent changes on the file system.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21989#discussion_r1835319664


More information about the nio-dev mailing list