RFR: 8316304: (fs) Add support for BasicFileAttributes.creationTime() for Linux [v3]
Severin Gehwolf
sgehwolf at openjdk.org
Tue Oct 3 10:05:27 UTC 2023
On Mon, 2 Oct 2023 13:12:20 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> 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```
>
> Hmm, @bplb `Platform.isMusl()` doesn't seem to work reliably. Running an alpine binary on Linux (Fedora) in my case, breaks this test as it gets `Platform.isMusl() == false`. Also, there is a chance where the JDK runs on an old glibc (<2.28) and new enough kernel, where this wouldn't work either. Using the reflective approach seems most consistent with what the code is actually doing. More thoughts?
For now I'd like to keep the reflective approach until we know a better way to determine support correctly otherwise.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15792#discussion_r1343845097
More information about the nio-dev
mailing list