Files
Astral/patches/openjdk17/jinx-working-patch.patch
T
2026-05-02 19:57:24 -03:00

628 lines
24 KiB
Diff

diff --git openjdk17-clean/make/autoconf/flags-cflags.m4 openjdk17-workdir/make/autoconf/flags-cflags.m4
index 66e01db..651621e 100644
--- openjdk17-clean/make/autoconf/flags-cflags.m4
+++ openjdk17-workdir/make/autoconf/flags-cflags.m4
@@ -616,7 +616,11 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# Where does this really belong??
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
PICFLAG="-fPIC"
- PIEFLAG="-fPIE"
+ if echo "$OPENJDK_TARGET_AUTOCONF_NAME" | grep -q 'astral'; then
+ PIEFLAG=""
+ else
+ PIEFLAG="-fPIE"
+ fi
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
# '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
# one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
diff --git openjdk17-clean/make/autoconf/flags-ldflags.m4 openjdk17-workdir/make/autoconf/flags-ldflags.m4
index 23bb33e..368f5a8 100644
--- openjdk17-clean/make/autoconf/flags-ldflags.m4
+++ openjdk17-workdir/make/autoconf/flags-ldflags.m4
@@ -132,7 +132,8 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -Wl,--allow-shlib-undefined"
# Enabling pie on 32 bit builds prevents the JVM from allocating a continuous
# java heap.
- if test "x$OPENJDK_TARGET_CPU_BITS" != "x32"; then
+ if test "x$OPENJDK_TARGET_CPU_BITS" != "x32" && \
+ ! echo "$OPENJDK_TARGET_AUTOCONF_NAME" | grep -q 'astral'; then
EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -pie"
fi
fi
diff --git openjdk17-clean/make/autoconf/platform.m4 openjdk17-workdir/make/autoconf/platform.m4
index eb66266..891759b 100644
--- openjdk17-clean/make/autoconf/platform.m4
+++ openjdk17-workdir/make/autoconf/platform.m4
@@ -220,6 +220,10 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
VAR_OS=aix
VAR_OS_TYPE=unix
;;
+ *astral*)
+ VAR_OS=linux
+ VAR_OS_TYPE=unix
+ ;;
*)
AC_MSG_ERROR([unsupported operating system $1])
;;
diff --git openjdk17-clean/make/modules/java.desktop/lib/Awt2dLibraries.gmk openjdk17-workdir/make/modules/java.desktop/lib/Awt2dLibraries.gmk
index badb6f8..6aaedc2 100644
--- openjdk17-clean/make/modules/java.desktop/lib/Awt2dLibraries.gmk
+++ openjdk17-workdir/make/modules/java.desktop/lib/Awt2dLibraries.gmk
@@ -786,6 +786,7 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false)
LIBS := $(JDKLIB_LIBS) $(LIBSPLASHSCREEN_LIBS) $(LIBZ_LIBS) \
$(GIFLIB_LIBS) $(LIBJPEG_LIBS) $(PNG_LIBS), \
LIBS_aix := -liconv, \
+ LIBS_linux := -liconv, \
))
TARGETS += $(BUILD_LIBSPLASHSCREEN)
diff --git openjdk17-clean/make/modules/java.instrument/Lib.gmk openjdk17-workdir/make/modules/java.instrument/Lib.gmk
index 3996ad2..727f312 100644
--- openjdk17-clean/make/modules/java.instrument/Lib.gmk
+++ openjdk17-workdir/make/modules/java.instrument/Lib.gmk
@@ -49,7 +49,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBINSTRUMENT, \
LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \
LIBS := $(JDKLIB_LIBS), \
LIBS_unix := -ljava -ljvm $(LIBZ_LIBS), \
- LIBS_linux := -ljli $(LIBDL), \
+ LIBS_linux := -ljli -liconv $(LIBDL), \
LIBS_aix := -liconv -ljli_static $(LIBDL), \
LIBS_macosx := -ljli -liconv -framework Cocoa -framework Security \
-framework ApplicationServices, \
diff --git openjdk17-clean/make/modules/jdk.jdwp.agent/Lib.gmk openjdk17-workdir/make/modules/jdk.jdwp.agent/Lib.gmk
index 0a041fe..9db8c4e 100644
--- openjdk17-clean/make/modules/jdk.jdwp.agent/Lib.gmk
+++ openjdk17-workdir/make/modules/jdk.jdwp.agent/Lib.gmk
@@ -62,7 +62,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJDWP, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := $(JDKLIB_LIBS), \
- LIBS_linux := $(LIBDL), \
+ LIBS_linux := -liconv $(LIBDL), \
LIBS_macosx := -liconv, \
LIBS_aix := -liconv, \
))
diff --git openjdk17-clean/src/hotspot/os/linux/gc/z/zSyscall_linux.cpp openjdk17-workdir/src/hotspot/os/linux/gc/z/zSyscall_linux.cpp
index ba26cbf..e72a9ea 100644
--- openjdk17-clean/src/hotspot/os/linux/gc/z/zSyscall_linux.cpp
+++ openjdk17-workdir/src/hotspot/os/linux/gc/z/zSyscall_linux.cpp
@@ -27,14 +27,31 @@
#include <unistd.h>
+#ifdef __astral__
+#include <sys/mman.h>
+#include <fcntl.h>
+#endif
+
int ZSyscall::memfd_create(const char *name, unsigned int flags) {
+#ifdef __astral__
+ return ::memfd_create(name, flags);
+#else
return syscall(SYS_memfd_create, name, flags);
+#endif
}
int ZSyscall::fallocate(int fd, int mode, size_t offset, size_t length) {
+#ifdef __astral__
+ return ::fallocate(fd, mode, offset, length);
+#else
return syscall(SYS_fallocate, fd, mode, offset, length);
+#endif
}
long ZSyscall::get_mempolicy(int* mode, unsigned long* nodemask, unsigned long maxnode, void* addr, unsigned long flags) {
+#ifdef __astral__
+ return 0;
+#else
return syscall(SYS_get_mempolicy, mode, nodemask, maxnode, addr, flags);
+#endif
}
diff --git openjdk17-clean/src/hotspot/os/linux/os_linux.cpp openjdk17-workdir/src/hotspot/os/linux/os_linux.cpp
index 3d24234..93e3a9c 100644
--- openjdk17-clean/src/hotspot/os/linux/os_linux.cpp
+++ openjdk17-workdir/src/hotspot/os/linux/os_linux.cpp
@@ -100,7 +100,11 @@
# include <poll.h>
# include <fcntl.h>
# include <string.h>
+
+#ifndef __astral__
# include <syscall.h>
+#endif
+
# include <sys/sysinfo.h>
# include <sys/ipc.h>
# include <sys/shm.h>
@@ -345,9 +349,13 @@ bool os::have_special_privileges() {
// Returns the kernel thread id of the currently running thread. Kernel
// thread id is used to access /proc.
pid_t os::Linux::gettid() {
+#ifdef __astral__
+ return ::gettid();
+#else
int rslt = syscall(SYS_gettid);
assert(rslt != -1, "must be."); // old linuxthreads implementation?
return (pid_t)rslt;
+#endif
}
// Returns the amount of swap currently configured, in bytes.
diff --git openjdk17-clean/src/hotspot/os/linux/waitBarrier_linux.cpp openjdk17-workdir/src/hotspot/os/linux/waitBarrier_linux.cpp
index 491f9e6..64ab97e 100644
--- openjdk17-clean/src/hotspot/os/linux/waitBarrier_linux.cpp
+++ openjdk17-workdir/src/hotspot/os/linux/waitBarrier_linux.cpp
@@ -26,7 +26,11 @@
#include "runtime/orderAccess.hpp"
#include "runtime/os.hpp"
#include "waitBarrier_linux.hpp"
+
+#ifndef __astral__
#include <sys/syscall.h>
+#endif
+
#include <linux/futex.h>
#define check_with_errno(check_type, cond, msg) \
@@ -38,8 +42,36 @@
#define guarantee_with_errno(cond, msg) check_with_errno(guarantee, cond, msg)
+#ifdef __astral__
+#define SYSCALL_FUTEX 51
+static long syscall(long func, long* ret, uint64_t p1 = 0, uint64_t p2 = 0, uint64_t p3 = 0, uint64_t p4 = 0, uint64_t p5 = 0, uint64_t p6 = 0) {
+ volatile long err;
+
+ register uint64_t r4 asm("r10") = p4;
+ register uint64_t r5 asm("r8") = p5;
+ register uint64_t r6 asm("r9") = p6;
+
+ asm volatile("syscall"
+ : "=a"(*ret), "=d"(err)
+ : "a"(func), "D"(p1), "S"(p2), "d"(p3), "r"(r4),
+ "r"(r5), "r"(r6)
+ : "memory", "rcx", "r11");
+ return err;
+}
+#endif
+
static int futex(volatile int *addr, int futex_op, int op_arg) {
+#ifdef __astral__
+ long ret;
+ long err = syscall(SYSCALL_FUTEX, &ret, (uint64_t)addr, futex_op & 1, op_arg, 0);
+ if (err) {
+ errno = err;
+ return -1;
+ }
+ return 0;
+#else
return syscall(SYS_futex, addr, futex_op, op_arg, NULL, NULL, 0);
+#endif
}
void LinuxWaitBarrier::arm(int barrier_tag) {
diff --git openjdk17-clean/src/hotspot/os/posix/vmError_posix.cpp openjdk17-workdir/src/hotspot/os/posix/vmError_posix.cpp
index 2e49c53..1c79516 100644
--- openjdk17-clean/src/hotspot/os/posix/vmError_posix.cpp
+++ openjdk17-workdir/src/hotspot/os/posix/vmError_posix.cpp
@@ -35,7 +35,7 @@
#include <sys/types.h>
#include <sys/wait.h>
-#ifdef LINUX
+#if defined(LINUX) && !defined(__astral__)
#include <sys/syscall.h>
#include <unistd.h>
#endif
@@ -46,7 +46,9 @@
#include <sys/syscall.h>
#include <unistd.h>
#endif
-
+#ifdef __astral__
+#include <unistd.h>
+#endif
// Needed for cancelable steps.
static volatile pthread_t reporter_thread_id;
diff --git openjdk17-clean/src/hotspot/os_cpu/linux_x86/gc/z/zSyscall_linux_x86.hpp openjdk17-workdir/src/hotspot/os_cpu/linux_x86/gc/z/zSyscall_linux_x86.hpp
index 8b578ab..9bd6978 100644
--- openjdk17-clean/src/hotspot/os_cpu/linux_x86/gc/z/zSyscall_linux_x86.hpp
+++ openjdk17-workdir/src/hotspot/os_cpu/linux_x86/gc/z/zSyscall_linux_x86.hpp
@@ -24,7 +24,9 @@
#ifndef OS_CPU_LINUX_X86_GC_Z_ZSYSCALL_LINUX_X86_HPP
#define OS_CPU_LINUX_X86_GC_Z_ZSYSCALL_LINUX_X86_HPP
+#ifndef __astral__
#include <sys/syscall.h>
+#endif
//
// Support for building on older Linux systems
diff --git openjdk17-clean/src/java.base/linux/classes/sun/nio/ch/DefaultSelectorProvider.java openjdk17-workdir/src/java.base/linux/classes/sun/nio/ch/DefaultSelectorProvider.java
index fa925f5..df152da 100644
--- openjdk17-clean/src/java.base/linux/classes/sun/nio/ch/DefaultSelectorProvider.java
+++ openjdk17-workdir/src/java.base/linux/classes/sun/nio/ch/DefaultSelectorProvider.java
@@ -36,7 +36,7 @@ import java.security.PrivilegedAction;
public class DefaultSelectorProvider {
private static final SelectorProviderImpl INSTANCE;
static {
- PrivilegedAction<SelectorProviderImpl> pa = EPollSelectorProvider::new;
+ PrivilegedAction<SelectorProviderImpl> pa = PollSelectorProvider::new;
INSTANCE = AccessController.doPrivileged(pa);
}
diff --git openjdk17-clean/src/java.base/share/native/libjli/jli_util.h openjdk17-workdir/src/java.base/share/native/libjli/jli_util.h
index 6aa26a0..4f92110 100644
--- openjdk17-clean/src/java.base/share/native/libjli/jli_util.h
+++ openjdk17-workdir/src/java.base/share/native/libjli/jli_util.h
@@ -111,6 +111,9 @@ JLI_CmdToArgs(char *cmdline);
#define JLI_Lseek lseek
#endif
#endif /* _WIN32 */
+#ifdef __astral__
+#define JLI_Lseek lseek
+#endif
/*
* Make launcher spit debug output.
diff --git openjdk17-clean/src/java.base/unix/classes/java/lang/ProcessImpl.java openjdk17-workdir/src/java.base/unix/classes/java/lang/ProcessImpl.java
index 2bf36f8..705daf3 100644
--- openjdk17-clean/src/java.base/unix/classes/java/lang/ProcessImpl.java
+++ openjdk17-workdir/src/java.base/unix/classes/java/lang/ProcessImpl.java
@@ -89,8 +89,11 @@ final class ProcessImpl extends Process {
BSD(LaunchMechanism.POSIX_SPAWN, LaunchMechanism.FORK),
+ ASTRAL(LaunchMechanism.FORK),
+
AIX(LaunchMechanism.POSIX_SPAWN, LaunchMechanism.FORK);
+
final LaunchMechanism defaultLaunchMechanism;
final Set<LaunchMechanism> validLaunchMechanisms;
@@ -135,6 +138,7 @@ final class ProcessImpl extends Process {
if (osName.equals("Linux")) { return LINUX; }
if (osName.contains("OS X")) { return BSD; }
if (osName.equals("AIX")) { return AIX; }
+ if (osName.equals("Astral")) { return ASTRAL; }
throw new Error(osName + " is not a supported OS platform.");
}
@@ -346,6 +350,7 @@ final class ProcessImpl extends Process {
*/
void initStreams(int[] fds, boolean forceNullOutputStream) throws IOException {
switch (platform) {
+ case ASTRAL:
case LINUX:
case BSD:
stdin = (fds[0] == -1) ?
@@ -464,6 +469,7 @@ final class ProcessImpl extends Process {
private void destroy(boolean force) {
switch (platform) {
+ case ASTRAL:
case LINUX:
case BSD:
case AIX:
diff --git openjdk17-clean/src/java.base/unix/native/jspawnhelper/jspawnhelper.c openjdk17-workdir/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
index 5f2f04d..aa16545 100644
--- openjdk17-clean/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
+++ openjdk17-workdir/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
@@ -35,8 +35,6 @@
#include "childproc.h"
-extern int errno;
-
#define ALLOC(X,Y) { \
void *mptr; \
mptr = malloc (Y); \
diff --git openjdk17-clean/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c openjdk17-workdir/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
index 8b900dc..657330e 100644
--- openjdk17-clean/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
+++ openjdk17-workdir/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c
@@ -485,10 +485,10 @@ void unix_getUserInfo(JNIEnv* env, jobject jinfo, uid_t uid) {
}
/*
- * The following functions are common on Solaris, Linux and AIX.
+ * The following functions are common on Solaris, Linux, AIX and Astral.
*/
-#if defined (__linux__) || defined(_AIX)
+#if defined (__linux__) || defined(_AIX) || defined(__astral__)
/*
* Returns the children of the requested pid and optionally each parent and
@@ -607,7 +607,7 @@ jint unix_getChildren(JNIEnv *env, jlong jpid, jlongArray jarray,
return count;
}
-#endif // defined (__linux__) || defined(_AIX)
+#endif // defined (__linux__) || defined(_AIX) || defined(__astral__)
/*
* The following functions are for AIX.
diff --git openjdk17-clean/src/java.base/unix/native/libjava/TimeZone_md.c openjdk17-workdir/src/java.base/unix/native/libjava/TimeZone_md.c
index 5c40fc8..5a49ad0 100644
--- openjdk17-clean/src/java.base/unix/native/libjava/TimeZone_md.c
+++ openjdk17-workdir/src/java.base/unix/native/libjava/TimeZone_md.c
@@ -59,7 +59,7 @@ static char *isFileIdentical(char* buf, size_t size, char *pathname);
#define fstat64 fstat
#endif
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__astral__)
static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
@@ -75,7 +75,7 @@ static const char popularZones[][4] = {"UTC", "GMT"};
static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
#endif
-#if defined(__linux__) || defined(MACOSX)
+#if defined(__linux__) || defined(MACOSX) || defined(__astral__)
/*
* Returns a pointer to the zone ID portion of the given zoneinfo file
diff --git openjdk17-clean/src/java.base/unix/native/libjava/io_util_md.c openjdk17-workdir/src/java.base/unix/native/libjava/io_util_md.c
index e207c57..4311740 100644
--- openjdk17-clean/src/java.base/unix/native/libjava/io_util_md.c
+++ openjdk17-workdir/src/java.base/unix/native/libjava/io_util_md.c
@@ -30,7 +30,7 @@
#include <string.h>
#include <unistd.h>
-#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(_AIX) || defined(__astral__)
#include <sys/ioctl.h>
#endif
diff --git openjdk17-clean/src/java.base/unix/native/libjava/jni_util_md.c openjdk17-workdir/src/java.base/unix/native/libjava/jni_util_md.c
index 460503c..c6968fc 100644
--- openjdk17-clean/src/java.base/unix/native/libjava/jni_util_md.c
+++ openjdk17-workdir/src/java.base/unix/native/libjava/jni_util_md.c
@@ -31,13 +31,19 @@
#include "jni_util.h"
#include "dlfcn.h"
-#if defined(LINUX) && (defined(_GNU_SOURCE) || \
+#if defined(__linux__) && (defined(_GNU_SOURCE) || \
(defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE < 200112L \
&& defined(_XOPEN_SOURCE) && _XOPEN_SOURCE < 600))
extern int __xpg_strerror_r(int, char *, size_t);
#define strerror_r(a, b, c) __xpg_strerror_r((a), (b), (c))
#endif
+#if defined(__astral__)
+#undef strerror_r
+extern int __gnu_strerror_r(int, char *, size_t);
+#define strerror_r(a, b, c) __gnu_strerror_r((a), (b), (c))
+#endif
+
void* getProcessHandle() {
static void *procHandle = NULL;
if (procHandle != NULL) {
diff --git openjdk17-clean/src/java.base/unix/native/libnet/Inet6AddressImpl.c openjdk17-workdir/src/java.base/unix/native/libnet/Inet6AddressImpl.c
index e9e7adb..b8efe10 100644
--- openjdk17-clean/src/java.base/unix/native/libnet/Inet6AddressImpl.c
+++ openjdk17-workdir/src/java.base/unix/native/libnet/Inet6AddressImpl.c
@@ -29,6 +29,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <netinet/in.h>
+#include <netinet/ip.h>
#include <netinet/icmp6.h>
#if defined(_ALLBSD_SOURCE)
diff --git openjdk17-clean/src/java.base/unix/native/libnet/NetworkInterface.c openjdk17-workdir/src/java.base/unix/native/libnet/NetworkInterface.c
index dcaf3fd..9d7389a 100644
--- openjdk17-clean/src/java.base/unix/native/libnet/NetworkInterface.c
+++ openjdk17-workdir/src/java.base/unix/native/libnet/NetworkInterface.c
@@ -47,7 +47,7 @@
#include "java_net_InetAddress.h"
-#if defined(__linux__)
+#if defined(__linux__) || defined(__astral__)
#define _PATH_PROCNET_IFINET6 "/proc/net/if_inet6"
#endif
@@ -1144,7 +1144,7 @@ static int openSocket(JNIEnv *env, int proto) {
}
/** Linux **/
-#if defined(__linux__)
+#if defined(__linux__) || defined(__astral__)
/*
* Opens a socket for further ioctl calls. Tries AF_INET socket first and
diff --git openjdk17-clean/src/java.base/unix/native/libnet/net_util_md.h openjdk17-workdir/src/java.base/unix/native/libnet/net_util_md.h
index 6883598..8a17572 100644
--- openjdk17-clean/src/java.base/unix/native/libnet/net_util_md.h
+++ openjdk17-workdir/src/java.base/unix/native/libnet/net_util_md.h
@@ -29,6 +29,7 @@
#include <netdb.h>
#include <poll.h>
#include <sys/socket.h>
+#include <netinet/in.h>
/************************************************************************
* Macros and constants
diff --git openjdk17-clean/src/java.base/unix/native/libnio/ch/FileChannelImpl.c openjdk17-workdir/src/java.base/unix/native/libnio/ch/FileChannelImpl.c
index 8cc753e..85650fe 100644
--- openjdk17-clean/src/java.base/unix/native/libnio/ch/FileChannelImpl.c
+++ openjdk17-workdir/src/java.base/unix/native/libnio/ch/FileChannelImpl.c
@@ -29,7 +29,7 @@
#include <sys/types.h>
#include <unistd.h>
-#if defined(__linux__)
+#if defined(__linux__) || defined(__astral__)
#include <sys/sendfile.h>
#elif defined(_AIX)
#include <string.h>
diff --git openjdk17-clean/src/java.base/unix/native/libnio/ch/FileDispatcherImpl.c openjdk17-workdir/src/java.base/unix/native/libnio/ch/FileDispatcherImpl.c
index c0c31d6..cf4251c 100644
--- openjdk17-clean/src/java.base/unix/native/libnio/ch/FileDispatcherImpl.c
+++ openjdk17-workdir/src/java.base/unix/native/libnio/ch/FileDispatcherImpl.c
@@ -40,6 +40,10 @@
#include <sys/ioctl.h>
#endif
+#ifdef __astral__
+#include <sys/ioctl.h>
+#endif
+
#if defined(_ALLBSD_SOURCE)
#define lseek64 lseek
#define stat64 stat
diff --git openjdk17-clean/src/java.base/unix/native/libnio/ch/NativeThread.c openjdk17-workdir/src/java.base/unix/native/libnio/ch/NativeThread.c
index 92dcb9e..15f3438 100644
--- openjdk17-clean/src/java.base/unix/native/libnio/ch/NativeThread.c
+++ openjdk17-workdir/src/java.base/unix/native/libnio/ch/NativeThread.c
@@ -34,7 +34,7 @@
#include <signal.h>
#include <pthread.h>
-#ifdef __linux__
+#if defined(__linux__) || defined(__astral__)
/* Also defined in net/linux_close.c */
#define INTERRUPT_SIGNAL (SIGRTMAX - 2)
#elif defined(_AIX)
diff --git openjdk17-clean/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c openjdk17-workdir/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
index 7bc14a0..a77a112 100644
--- openjdk17-clean/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
+++ openjdk17-workdir/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
@@ -41,7 +41,7 @@
#endif
#include <sys/time.h>
-#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(__astral__)
#include <sys/xattr.h>
#endif
@@ -54,7 +54,7 @@
#include <sys/sysmacros.h> // makedev macros
#endif
-#if defined(__linux__) || defined(_AIX)
+#if defined(__linux__) || defined(__astral__) || defined(_AIX)
#include <string.h>
#endif
diff --git openjdk17-clean/src/java.desktop/share/classes/sun/awt/OSInfo.java openjdk17-workdir/src/java.desktop/share/classes/sun/awt/OSInfo.java
index 8770ed2..fe02b7d 100644
--- openjdk17-clean/src/java.desktop/share/classes/sun/awt/OSInfo.java
+++ openjdk17-workdir/src/java.desktop/share/classes/sun/awt/OSInfo.java
@@ -40,6 +40,7 @@ public class OSInfo {
LINUX,
MACOSX,
AIX,
+ ASTRAL,
UNKNOWN
}
@@ -107,6 +108,10 @@ public class OSInfo {
return AIX;
}
+ if (osName.contains("Astral")) {
+ return ASTRAL;
+ }
+
// determine another OS here
}
diff --git openjdk17-clean/src/java.desktop/unix/native/common/awt/fontpath.c openjdk17-workdir/src/java.desktop/unix/native/common/awt/fontpath.c
index df35e78..ac8b36e 100644
--- openjdk17-clean/src/java.desktop/unix/native/common/awt/fontpath.c
+++ openjdk17-workdir/src/java.desktop/unix/native/common/awt/fontpath.c
@@ -23,7 +23,7 @@
* questions.
*/
-#if defined(__linux__)
+#if defined(__linux__) || defined(__astral__)
#include <string.h>
#endif /* __linux__ */
#include <stdio.h>
@@ -61,7 +61,7 @@ extern Display *awt_display;
#define MAXFDIRS 512 /* Max number of directories that contain fonts */
-#if defined( __linux__)
+#if defined( __linux__) || defined(__astral__)
/* All the known interesting locations we have discovered on
* various flavors of Linux
*/
@@ -324,7 +324,7 @@ static char *getPlatformFontPathChars(JNIEnv *env, jboolean noType1, jboolean is
*/
fcdirs = getFontConfigLocations();
-#if defined(__linux__)
+#if defined(__linux__) || defined(__astral__)
knowndirs = fullLinuxFontPath;
#elif defined(_AIX)
knowndirs = fullAixFontPath;
diff --git openjdk17-clean/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c openjdk17-workdir/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c
index 4e15ddd..61c998c 100644
--- openjdk17-clean/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c
+++ openjdk17-workdir/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c
@@ -55,7 +55,7 @@ Java_java_util_prefs_FileSystemPreferences_chmod(JNIEnv *env,
return (jint) result;
}
-#if defined(_ALLBSD_SOURCE)
+#if defined(_ALLBSD_SOURCE) || defined(__astral__)
typedef struct flock FLOCK;
#else
typedef struct flock64 FLOCK;
diff --git openjdk17-clean/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c openjdk17-workdir/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c
index 3068f47..e2debec 100644
--- openjdk17-clean/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c
+++ openjdk17-workdir/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c
@@ -280,7 +280,7 @@ static attach_state_t ptrace_attach(pid_t pid, char* err_buf, size_t err_buf_len
// GNU-specific: char *strerror_r(int errnum, char *buf, size_t buflen);
// XSI-compliant: int strerror_r(int errnum, char *buf, size_t buflen);
char buf[200];
-#if defined(__GLIBC__) && defined(_GNU_SOURCE)
+#if (defined(__GLIBC__) || defined(__astral__)) && defined(_GNU_SOURCE)
char* msg = strerror_r(errno, buf, sizeof(buf));
#else
int rc = strerror_r(errno, buf, sizeof(buf));
diff --git openjdk17-clean/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c openjdk17-workdir/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c
index e33d9b4..39f784f 100644
--- openjdk17-clean/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c
+++ openjdk17-workdir/src/jdk.management/unix/native/libmanagement_ext/OperatingSystemImpl.c
@@ -63,7 +63,7 @@
static jlong page_size = 0;
-#if defined(_ALLBSD_SOURCE) || defined(_AIX)
+#if defined(_ALLBSD_SOURCE) || defined(_AIX) || defined(__astral__)
#define MB (1024UL * 1024UL)
#else
@@ -235,7 +235,7 @@ Java_com_sun_management_internal_OperatingSystemImpl_getFreeMemorySize0
return -1;
}
return (jlong)vm_stats.free_count * page_size;
-#elif defined(_ALLBSD_SOURCE)
+#elif defined(_ALLBSD_SOURCE) || defined(__astral__)
/*
* XXBSDL no way to do it in FreeBSD
*/
@@ -276,6 +276,8 @@ Java_com_sun_management_internal_OperatingSystemImpl_getTotalMemorySize0
return (jlong)(memory_info.real_total * 4L * 1024L);
}
return -1;
+#elif defined(__astral__)
+ return (128 * MB);
#else // solaris / linux
jlong num_physical_pages = sysconf(_SC_PHYS_PAGES);
return (num_physical_pages * page_size);