RFR: 8316304: (fs) Add support for BasicFileAttributes.creationTime() for Linux [v2]

Severin Gehwolf sgehwolf at openjdk.org
Thu Sep 28 12:36:26 UTC 2023


On Thu, 21 Sep 2023 17:29:44 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 one new commit since the last revision:
> 
>   8316304: (fs) Add support for BasicFileAttributes.creationTime() for Linux

Sorry for the late reply. I was travelling.

> > Thanks for your input! Here is an updated patch, now using LinuxFileSystemProvider and the logic to use `statx` is now in the linux specific directory trees. The fallback code is unchanged (using `UnixNativeDispatcher`). This version never uses both `stat64` and `statx`. It only uses `statx` if its available and uses the older `stat64` otherwise.
> 
> I was chatting with @bplb about this change, mostly about testing and maintainability. We both agreed that this PR isn't the right place to do the refactoring, there is a lot disruptive changes needed to allow overriding of what is currently in the Unix* code. So if it's okay with you, we think go back the original/smaller change in UnixNativeDispatcher.c but use stat or statx, before both, as you have in the second iteration. Would that be okay with you?

Fair enough. Hopefully we can make progress on that third version then.

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

PR Comment: https://git.openjdk.org/jdk/pull/15792#issuecomment-1739070969


More information about the nio-dev mailing list