RFR: 8316304: (fs) Add support for BasicFileAttributes.creationTime() for Linux [v3]
Brian Burkhalter
bpb at openjdk.org
Fri Sep 29 17:04:19 UTC 2023
On Fri, 29 Sep 2023 16:35:09 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 refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains three new commits since the last revision:
>
> - Wrap copy_statx_attributes with ifdef __linux__
> - Fix compile warnings.
> - 8316304: (fs) Add support for BasicFileAttributes.creationTime() for Linux
src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c line 239:
> 237: #if defined(__linux__)
> 238: typedef int statx_func(int dirfd, const char *restrict pathname, int flags,
> 239: unsigned int mask, struct statx *restrict statxbuf);
Align `unsigned int mask` under `int dirfd`.
src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c line 280:
> 278: #if defined(__linux__)
> 279: static int statx_wrapper(int dirfd, const char *restrict pathname, int flags,
> 280: unsigned int mask, struct statx *restrict statxbuf, int follow_symlink) {
Align as done elsewhere in this file.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15792#discussion_r1341604877
PR Review Comment: https://git.openjdk.org/jdk/pull/15792#discussion_r1341606589
More information about the nio-dev
mailing list