[jdk17u-dev] RFR: 8316304: (fs) Add support for BasicFileAttributes.creationTime() for Linux

Severin Gehwolf sgehwolf at openjdk.org
Thu Jan 25 15:12:57 UTC 2024


This is an unclean backport of the filesystem enhancement on Linux to use `statx` where available. The JDK 21u patch didn't apply cleanly because JDK 20+ has [JDK-8283335](https://bugs.openjdk.org/browse/JDK-8283335) which isn't needed for this backport. The relevant code has been adjusted to work without that enhancement being present (see different commits). Copyright dates needed manual adjusting and the test needed some trivial changes related to test lib and import so that it works (failed to compile on 17u).

As for the code changes in `UnixNativeDispatcher.c`, the JNI method `Java_sun_nio_fs_UnixNativeDispatcher_stat1()` returning the mode for a file/directory doesn't exist in JDK 21 (again [JDK-8283335](https://bugs.openjdk.org/browse/JDK-8283335)). Therefore, I've adjusted the code to also use `statx` where available for symmetry.

I'll follow up with the related build fix (for the test libs) in a dependent PR (JDK-8319922).

Please review!

Testing:
- [ ] GHA (still running).
- [ ] Build test on various Linux (aarch64, Alpine x64, ppc64le, x64) and Unix OSes (AIX, Mac) so as to not break the build there.  On-going.
- [x] Manual testing for `BasicFileAttributes.creationTime()`. Looks good.

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

Commit messages:
 - Fix test (add missing import, missing test lib)
 - Add statx support for Java_sun_nio_fs_UnixNativeDispatcher_stat1
 - Account for JDK 17 differences in stat0()
 - Backport 0275efac882d263f85a723828a95d621f8dadbfb

Changes: https://git.openjdk.org/jdk17u-dev/pull/2175/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk17u-dev&pr=2175&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8316304
  Stats: 342 lines in 6 files changed: 325 ins; 0 del; 17 mod
  Patch: https://git.openjdk.org/jdk17u-dev/pull/2175.diff
  Fetch: git fetch https://git.openjdk.org/jdk17u-dev.git pull/2175/head:pull/2175

PR: https://git.openjdk.org/jdk17u-dev/pull/2175


More information about the jdk-updates-dev mailing list