RFR: 8316304: (fs) Add support for BasicFileAttributes.creationTime() for Linux [v8]
Brian Burkhalter
bpb at openjdk.org
Tue Oct 3 18:10:56 UTC 2023
On Tue, 3 Oct 2023 17:41:24 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:
>
> - Link libCreationTimeHelper with -ldl
> - Merge branch 'master' into JDK-8316304-statx-create-time-new
> - Cleanup UnixNativeDispatcher.c
> - Refactor test so as to not use reflection
> - Fix indents
> - Check correct fieldID
> - Add copyright
> - Add support for nano seconds for btime on Linux
> - Fix style
> - Wrap copy_statx_attributes with ifdef __linux__
> - ... and 2 more: https://git.openjdk.org/jdk/compare/65113b79...83347ec1
test/jdk/java/nio/file/attribute/BasicFileAttributeView/libCreationTimeHelper.c line 33:
> 31: {
> 32: #if defined(__linux__)
> 33: void* statx_func = dlsym(RTLD_DEFAULT, "statx");
For commit 04226fd470bc9a238e83606cb7f62ebd64d44421, which is the penultimate commit, I am seeing the build error:
open/test/jdk/java/nio/file/attribute/BasicFileAttributeView/libCreationTimeHelper.c:33: error: undefined reference to 'dlsym'```
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15792#discussion_r1344525162
More information about the nio-dev
mailing list