RFR: 8316304: (fs) Add support for BasicFileAttributes.creationTime() for Linux [v5]
Alan Bateman
alanb at openjdk.org
Tue Oct 3 10:14:19 UTC 2023
On Tue, 3 Oct 2023 10:02:32 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> Please review this nio change which adds `BasicFileAttributes.creationTime()` support for Linux by means of the `statx` Linux specific system call. The patch does a dynamic lookup of the function and if it is available, uses it to set the support birth time capability in `UnixNativeDispatcher`. When `statx` is not available, it won't use it and fall back to the old behaviour on such systems. It should, however, compile fine on Linux systems not supporting the `statx` system call.
>>
>> Testing:
>> - [x] GHA (MacOS X failure seems unrelated)
>> - [x] `java.nio` tests.
>> - [x] Manual builds and tests on older glibc versions (2.17 => fallback, 2.28+ => works). Compiles fine and falls back to the not supported case as it was before this patch.
>>
>> Thoughts?
>
> Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision:
>
> Add support for nano seconds for btime on Linux
src/java.base/unix/classes/sun/nio/fs/UnixFileAttributes.java line 28:
> 26: package sun.nio.fs;
> 27:
> 28: import java.nio.file.attribute.BasicFileAttributes;
I assume you'll update the copyright date on this file.
src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c line 706:
> 704: #if defined(__linux__)
> 705: }
> 706: #endif
Can you replace this with #if defined(__linux) .. #else .. #endif as it will make it easier to read. There are several places where we'll need to fix the indent with nested ifdef usage as it's hard to ready right now.
test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java line 140:
> 138: return (boolean)supportsBirthTime.invoke(null);
> 139: } catch (Throwable e) {
> 140: throw new RuntimeException("Illegal state!");
I agree with Brian, we need to find a better way to do this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15792#discussion_r1343854783
PR Review Comment: https://git.openjdk.org/jdk/pull/15792#discussion_r1343857110
PR Review Comment: https://git.openjdk.org/jdk/pull/15792#discussion_r1343857459
More information about the nio-dev
mailing list