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

Severin Gehwolf sgehwolf at openjdk.org
Mon Oct 2 12:47:17 UTC 2023


On Fri, 29 Sep 2023 17:27:03 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> 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
>
> test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java line 34:
> 
>> 32:  */
>> 33: 
>> 34: import java.lang.reflect.Method;
> 
> Instead of using reflective access, would it be possible to use the "os.version" property and a minimum kernel version (4.11?)?
> 
> 
> jshell> System.getProperty("os.version")
> $1 ==> "5.19.0-50-generic"
> 
> jshell> 
> bpb at bpb-vb-u2204:~$ uname -a
> Linux bpb-vb-u2204 5.19.0-50-generic #50-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 10 18:24:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux```

It's not the full story. On an alpine build, on `5.19.0-50` it would report the wrong value. It's not supported, since the libc impl doesn't support it. The kernel itself would as a regular, non-alpine build, attests. I could use `!Platform.isMusl()` in addition if that sounds OK?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15792#discussion_r1342638406


More information about the nio-dev mailing list