From f838ddfd810624f674f394b38f946a890cfd762b Mon Sep 17 00:00:00 2001 From: sendaoYan Date: Wed, 4 Sep 2024 23:29:21 +0800 Subject: [PATCH] fix compile error: libCreationTimeHelper.c:24:10: fatal error: 'linux/fcntl.h' file not found on windows and macos --- .../attribute/BasicFileAttributeView/CreationTime.java | 4 ++-- .../BasicFileAttributeView/libCreationTimeHelper.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java b/test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java index c34f19a26af03..fb673161f17ab 100644 --- a/test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java +++ b/test/jdk/java/nio/file/attribute/BasicFileAttributeView/CreationTime.java @@ -27,7 +27,7 @@ * that support it, tests using /tmp directory. * @library ../.. /test/lib * @build jdk.test.lib.Platform - * @run main CreationTime + * @run main/native CreationTime */ /* @test id=cwd @@ -36,7 +36,7 @@ * scratch directory maybe at diff disk partition to /tmp on linux. * @library ../.. /test/lib * @build jdk.test.lib.Platform - * @run main CreationTime . + * @run main/native CreationTime . */ import java.lang.foreign.Linker; diff --git a/test/jdk/java/nio/file/attribute/BasicFileAttributeView/libCreationTimeHelper.c b/test/jdk/java/nio/file/attribute/BasicFileAttributeView/libCreationTimeHelper.c index 08aec2dbec78d..8bee748e9f4e5 100644 --- a/test/jdk/java/nio/file/attribute/BasicFileAttributeView/libCreationTimeHelper.c +++ b/test/jdk/java/nio/file/attribute/BasicFileAttributeView/libCreationTimeHelper.c @@ -21,6 +21,7 @@ * questions. */ #include "jni.h" +#if defined(__linux__) #include #include #include @@ -78,13 +79,11 @@ struct my_statx __uint64_t __statx_pad2[14]; }; -#if defined(__linux__) typedef int statx_func(int dirfd, const char *restrict pathname, int flags, unsigned int mask, struct my_statx *restrict statxbuf); -#endif -#if defined(__linux__) + static statx_func* my_statx_func = NULL; -#endif +#endif //#defined(__linux__) // static native boolean linuxIsCreationTimeSupported() JNIEXPORT jboolean JNICALL