Skip to content

Commit

Permalink
svm: adopt "JDK- 8316304: (fs) Add support for BasicFileAttributes.cr…
Browse files Browse the repository at this point in the history
…eationTime() for Linux"

openjdk/jdk@0275efa
(cherry picked from commit 5a8a6ec)
  • Loading branch information
zapster authored and elkorchi committed Nov 21, 2023
1 parent 6bd3a09 commit 6b9b813
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package com.oracle.svm.hosted.jdk;

import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
Expand All @@ -38,6 +39,7 @@
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
import com.oracle.svm.core.feature.InternalFeature;
import com.oracle.svm.core.jdk.JNIRegistrationUtil;
import com.oracle.svm.util.ReflectionUtil;

/**
* Registration of classes, methods, and fields accessed via JNI by C code of the JDK.
Expand Down Expand Up @@ -156,10 +158,15 @@ private static void registerUnixNativeDispatcherInit(DuringAnalysisAccess a) {
RuntimeJNIAccess.register(fields(a, "sun.nio.fs.UnixFileAttributes",
"st_mode", "st_ino", "st_dev", "st_rdev", "st_nlink", "st_uid", "st_gid", "st_size",
"st_atime_sec", "st_atime_nsec", "st_mtime_sec", "st_mtime_nsec", "st_ctime_sec", "st_ctime_nsec"));
if (isDarwin()) {
if (isDarwin() || JavaVersionUtil.JAVA_SPEC >= 21 && isLinux()) {
RuntimeJNIAccess.register(fields(a, "sun.nio.fs.UnixFileAttributes", "st_birthtime_sec"));
}

Field unixCreationTimeField = ReflectionUtil.lookupField(true, clazz(a, "sun.nio.fs.UnixFileAttributes"), "st_birthtime_nsec");
if (unixCreationTimeField != null) {
RuntimeJNIAccess.register(fields(a, "sun.nio.fs.UnixFileAttributes", "st_birthtime_nsec"));
}

RuntimeJNIAccess.register(clazz(a, "sun.nio.fs.UnixFileStoreAttributes"));
RuntimeJNIAccess.register(fields(a, "sun.nio.fs.UnixFileStoreAttributes", "f_frsize", "f_blocks", "f_bfree", "f_bavail"));
RuntimeJNIAccess.register(clazz(a, "sun.nio.fs.UnixMountEntry"));
Expand Down

0 comments on commit 6b9b813

Please sign in to comment.