Merge pull request #16 from Qwinci/openjdk-work

Add openjdk17 port
This commit is contained in:
Matheus
2025-01-13 11:46:23 -03:00
committed by GitHub
22 changed files with 745 additions and 13 deletions
+7
View File
@@ -0,0 +1,7 @@
name=host-openjdk-bin
revision=1
from_source=host-openjdk-bin
package() {
cp -r "${source_dir}/." "${dest_dir}/${prefix}"
}
+3 -1
View File
@@ -28,6 +28,7 @@
#define AT_PHENT 4
#define AT_PHNUM 5
#define AT_ENTRY 9
#define AT_EXECFN 31
typedef struct {
uint64_t type;
@@ -39,6 +40,7 @@ typedef struct {
auxv64_t phnum;
auxv64_t phent;
auxv64_t entry;
auxv64_t execfn;
auxv64_t null;
} auxv64list_t;
@@ -83,6 +85,6 @@ typedef struct{
} __attribute__((packed)) elfph64_t;
int elf_load(vnode_t *vnode, void *base, void **entry, char **interpreter, auxv64list_t *auxv64);
void *elf_preparestack(void *top, auxv64list_t *auxv64, char **argv, char **envp);
void *elf_preparestack(void *top, auxv64list_t *auxv64, char **argv, char **envp, char *path);
#endif
+7 -4
View File
@@ -169,6 +169,9 @@ static void insertrange(vmmspace_t *space, vmmrange_t *newrange) {
while (range->next) {
if (newrange->start >= RANGE_TOP(range) && newrange->start < range->next->start) { // space inbetween two other ranges
newrange->next = range->next;
if (newrange->next)
newrange->next->prev = newrange;
newrange->prev = range;
range->next = newrange;
goto fragcheck;
@@ -659,21 +662,21 @@ bool vmm_pagefault(void *addr, bool user, int actions) {
}
void *vmm_getphysical(void *addr, bool hold) {
addr = (void *)ROUND_DOWN((uintptr_t)addr, PAGE_SIZE);
void *aligned_addr = (void *)ROUND_DOWN((uintptr_t)addr, PAGE_SIZE);
vmmspace_t *space = getspace(addr);
vmmspace_t *space = getspace(aligned_addr);
if (space == NULL)
return NULL;
MUTEX_ACQUIRE(&space->lock);
void *physical = arch_mmu_getphysical(current_vmm_context()->pagetable, addr);
void *physical = arch_mmu_getphysical(current_vmm_context()->pagetable, aligned_addr);
if (hold)
pmm_hold(physical);
MUTEX_RELEASE(&space->lock);
return physical + ((uintptr_t)addr - ROUND_DOWN((uintptr_t)addr, PAGE_SIZE));
return physical + ((uintptr_t)addr - (uintptr_t)aligned_addr);
}
+15 -4
View File
@@ -153,6 +153,10 @@ int elf_load(vnode_t *vnode, void *base, void **entry, char **interpreter, auxv6
if (headerok(&header) == false)
return ENOEXEC;
if (!base && header.type == ELF_SHARED) {
base = (void *)0x400000;
}
auxv64->null.type = AT_NULL;
auxv64->phdr.type = AT_PHDR;
auxv64->phnum.type = AT_PHNUM;
@@ -161,7 +165,7 @@ int elf_load(vnode_t *vnode, void *base, void **entry, char **interpreter, auxv6
auxv64->phnum.val = header.phcount;
auxv64->phent.val = header.phsize;
auxv64->entry.val = header.entry;
auxv64->entry.val = header.entry + (uintptr_t)base;
*entry = (void *)(header.entry + (uintptr_t)base);
__assert(header.phsize == sizeof(elfph64_t));
@@ -215,11 +219,12 @@ int elf_load(vnode_t *vnode, void *base, void **entry, char **interpreter, auxv6
#define STACK_SIZE (1024 * 1024 * 4)
#define STACK_TOP_BUFFER 8
void *elf_preparestack(void *top, auxv64list_t *auxv64, char **argv, char **envp) {
void *elf_preparestack(void *top, auxv64list_t *auxv64, char **argv, char **envp, char *path) {
size_t argc;
size_t envc;
size_t argdatasize = 0;
size_t envdatasize = 0;
size_t pathsize = strlen(path) + 1;
for (argc = 0; argv[argc]; ++argc)
argdatasize += strlen(argv[argc]) + 1;
@@ -231,7 +236,7 @@ void *elf_preparestack(void *top, auxv64list_t *auxv64, char **argv, char **envp
int alignment = ((argc + 1) + (envc + 1) + 1) & 1 ? 8 : 0;
// env data + arg data + pointers to arg and env data + argc + buffer at the top
size_t initialsize = argdatasize + envdatasize + (argc + envc) * sizeof(char *) + sizeof(size_t) + sizeof(auxv64list_t) + alignment + STACK_TOP_BUFFER;
size_t initialsize = argdatasize + envdatasize + pathsize + (argc + envc) * sizeof(char *) + sizeof(size_t) + sizeof(auxv64list_t) + alignment + STACK_TOP_BUFFER;
size_t initialsizeround = ROUND_UP(initialsize, PAGE_SIZE);
void *initialpagebase = (void *)((uintptr_t)top - initialsizeround);
@@ -247,7 +252,8 @@ void *elf_preparestack(void *top, auxv64list_t *auxv64, char **argv, char **envp
char *argdatastart = (char *)((uintptr_t)top - argdatasize);
char *envdatastart = (char *)((uintptr_t)argdatastart - envdatasize);
auxv64list_t *auxvstart = (auxv64list_t *)envdatastart - 1;
char *pathdatastart = (char *)((uintptr_t)envdatastart - pathsize);
auxv64list_t *auxvstart = (auxv64list_t *)pathdatastart - 1;
auxvstart = (auxv64list_t *)(((uintptr_t)auxvstart & ~(uintptr_t)0xf) - alignment);
@@ -256,6 +262,11 @@ void *elf_preparestack(void *top, auxv64list_t *auxv64, char **argv, char **envp
char **argstart = (char **)envstart - argc - 1;
size_t *argcptr = (size_t *)argstart - 1;
auxv64->execfn.type = AT_EXECFN;
auxv64->execfn.val = (uint64_t)pathdatastart;
memcpy(pathdatastart, path, pathsize);
memcpy(auxvstart, auxv64, sizeof(auxv64list_t));
for (int i = 0; i < argc; ++i) {
+1 -1
View File
@@ -361,7 +361,7 @@ void proc_run_init() {
char *argv[] = {"/init", cmdline_get("initarg"), NULL};
char *envp[] = {NULL};
void *stack = elf_preparestack(STACK_TOP, &auxv64, argv, envp);
void *stack = elf_preparestack(STACK_TOP, &auxv64, argv, envp, "/init");
__assert(stack);
// reenter kernel context
+2
View File
@@ -5,6 +5,7 @@
#include <kernel/vmm.h>
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
#define CLOCK_BOOTTIME 7
syscallret_t syscall_clockget(context_t *, int clockid, timespec_t *tp) {
@@ -19,6 +20,7 @@ syscallret_t syscall_clockget(context_t *, int clockid, timespec_t *tp) {
ret.errno = 0;
break;
}
case CLOCK_MONOTONIC:
case CLOCK_BOOTTIME: {
timespec_t ts = timekeeper_timefromboot();
usercopy_touser(tp, &ts, sizeof(timespec_t));
+1 -1
View File
@@ -258,7 +258,7 @@ static syscallret_t execve(context_t *context, char *upath, char *uargv[], char
VOP_RELEASE(interpnode);
}
stack = elf_preparestack(STACK_TOP, &auxv64, argv, envp);
stack = elf_preparestack(STACK_TOP, &auxv64, argv, envp, path);
if (stack == NULL) {
ret.errno = ENOMEM;
goto error;
+7
View File
@@ -9,6 +9,8 @@
#define F_SETFD 2
#define F_GETFL 3
#define F_SETFL 4
#define F_SETLK64 6
#define F_SETLKW64 7
#define FD_CLOEXEC 1
@@ -52,6 +54,11 @@ syscallret_t syscall_fcntl(context_t *, int fd, int cmd, uint64_t arg) {
ret.errno = fd_getflags(fd, &flg);
ret.ret = flg ? FD_CLOEXEC : 0;
break;
case F_SETLK64:
case F_SETLKW64:
ret.errno = 0;
ret.ret = 0;
break;
default:
ret.errno = EINVAL;
goto cleanup;
+2 -1
View File
@@ -13,9 +13,10 @@
#define MAP_FIXED 0x10
#define MAP_ANON 0x20
#define MAP_ANONYMOUS MAP_ANON
#define MAP_NORESERVE 0x4000
#define KNOWN_PROT (PROT_READ | PROT_WRITE | PROT_EXEC)
#define KNOWN_FLAGS (MAP_SHARED | MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS)
#define KNOWN_FLAGS (MAP_SHARED | MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS | MAP_NORESERVE)
syscallret_t syscall_mmap(context_t *context, void *hint, size_t len, int prot, int flags, int fd, off_t offset) {
syscallret_t ret = {
+1 -1
View File
@@ -67,7 +67,7 @@ syscallret_t syscall_seek(context_t *context, int fd, off_t offset, int whence)
}
break;
case SEEK_END:
newoffset = size;
newoffset = size + offset;
break;
}
+35
View File
@@ -0,0 +1,35 @@
diff --git alsa-lib-clean/src/conf.c alsa-lib-workdir/src/conf.c
index 468d41f..97e6f0f 100644
--- alsa-lib-clean/src/conf.c
+++ alsa-lib-workdir/src/conf.c
@@ -435,6 +435,13 @@ beginning:</P>
#include <pthread.h>
#endif
+#ifdef __astral__
+#define versionsort64 versionsort
+#define scandir64 scandir
+#define dirent64 dirent
+#define ino64_t ino_t
+#endif
+
#ifndef DOC_HIDDEN
#ifdef HAVE_LIBPTHREAD
diff --git alsa-lib-clean/src/ucm/parser.c alsa-lib-workdir/src/ucm/parser.c
index 488a5c6..7a6d1db 100644
--- alsa-lib-clean/src/ucm/parser.c
+++ alsa-lib-workdir/src/ucm/parser.c
@@ -36,6 +36,12 @@
#include <dirent.h>
#include <limits.h>
+#ifdef __astral__
+#define scandir64 scandir
+#define versionsort64 versionsort
+#define dirent64 dirent
+#endif
+
static int filename_filter(const struct dirent64 *dirent);
static int parse_sequence(snd_use_case_mgr_t *uc_mgr,
+50
View File
@@ -111,3 +111,53 @@ index 9219ef0..1ff679c 100644
#if __MLIBC_POSIX_OPTION
#include <dlfcn.h>
#endif
diff --git mlibc-clean/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
index 2a504ab..61c3bf0 100644
--- mlibc-clean/sysdeps/astral/generic/generic.cpp
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
@@ -31,6 +31,12 @@ namespace mlibc {
return 0;
}
+ int sys_getcpu(int *cpu) {
+ *cpu = 0;
+ // TODO unstub
+ return 0;
+ }
+
int sys_getsockopt(int fd, int layer, int number,
void *__restrict buffer, socklen_t *__restrict size) {
(void)size;
@@ -161,7 +167,18 @@ namespace mlibc {
*bytes_written = writec;
return error;
}
-
+
+ int sys_getrlimit(int resource, struct rlimit *limit) {
+ switch(resource) {
+ case RLIMIT_NOFILE:
+ limit->rlim_cur = RLIM_INFINITY;
+ limit->rlim_max = RLIM_INFINITY;
+ return 0;
+ default:
+ return EINVAL;
+ }
+ }
+
#ifndef MLIBC_BUILDING_RTLD
typedef struct {
@@ -487,6 +504,12 @@ namespace mlibc {
return ret;
}
+ pid_t sys_gettid() {
+ long ret;
+ syscall(SYSCALL_GETTID, &ret);
+ return ret;
+ }
+
#ifndef MLIBC_BUILDING_RTLD
[[noreturn]] void sys_thread_exit() {
+470
View File
@@ -0,0 +1,470 @@
diff --git openjdk17-clean/make/autoconf/platform.m4 openjdk17-workdir/make/autoconf/platform.m4
index 2dd13d0..1aca7f7 100644
--- openjdk17-clean/make/autoconf/platform.m4
+++ openjdk17-workdir/make/autoconf/platform.m4
@@ -214,6 +214,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 4d0c0c0..0a95a24 100644
--- openjdk17-clean/make/modules/java.desktop/lib/Awt2dLibraries.gmk
+++ openjdk17-workdir/make/modules/java.desktop/lib/Awt2dLibraries.gmk
@@ -751,6 +751,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 aef358c..fbc1750 100644
--- openjdk17-clean/make/modules/jdk.jdwp.agent/Lib.gmk
+++ openjdk17-workdir/make/modules/jdk.jdwp.agent/Lib.gmk
@@ -61,7 +61,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 239cd0d..8090c53 100644
--- openjdk17-clean/src/hotspot/os/linux/os_linux.cpp
+++ openjdk17-workdir/src/hotspot/os/linux/os_linux.cpp
@@ -98,7 +98,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>
@@ -348,9 +352,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
}
// Most versions of linux have a bug where the number of processors are
diff --git openjdk17-clean/src/hotspot/os/linux/waitBarrier_linux.cpp openjdk17-workdir/src/hotspot/os/linux/waitBarrier_linux.cpp
index 491f9e6..e9530f0 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, NULL);
+ 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 845dda6..ca61d72 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 3512b1e..727be0d 100644
--- openjdk17-clean/src/java.base/share/native/libjli/jli_util.h
+++ openjdk17-workdir/src/java.base/share/native/libjli/jli_util.h
@@ -115,6 +115,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/native/jspawnhelper/jspawnhelper.c openjdk17-workdir/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
index 1388201..db47119 100644
--- openjdk17-clean/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
+++ openjdk17-workdir/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
@@ -33,8 +33,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 d53e887..35d1121 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 94dfc20..af060ac 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..47a0236 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,7 +31,7 @@
#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);
diff --git openjdk17-clean/src/java.base/unix/native/libnet/Inet6AddressImpl.c openjdk17-workdir/src/java.base/unix/native/libnet/Inet6AddressImpl.c
index 058f3d3..bcfd46f 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 990bc1b..b231b8b 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 e0debb0..cdb7435 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 8821461..f97ccda 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 9df8be1..be0aa40 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
diff --git openjdk17-clean/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c openjdk17-workdir/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c
index c591f04..a79b0a8 100644
--- openjdk17-clean/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c
+++ openjdk17-workdir/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c
@@ -55,8 +55,9 @@ 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;
+#define F_SETLK64 F_SETLK
#else
typedef struct flock64 FLOCK;
#endif
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);
+19
View File
@@ -0,0 +1,19 @@
name=alsa-lib
revision=1
from_source=alsa-lib
imagedeps="build-essential"
hostdeps="xgcc xbinutils pkgconfig autoconf automake"
deps="base"
configure() {
cp -r "${source_dir}/." "."
./configure --prefix=${prefix} --host=x86_64-astral
}
build() {
make -j${parallelism}
}
package() {
make DESTDIR=${dest_dir} install
}
+30
View File
@@ -0,0 +1,30 @@
name=cups
revision=1
from_source=cups
imagedeps="build-essential xdg-utils"
hostdeps="xgcc xbinutils pkgconfig"
deps="base libiconv zlib"
configure() {
cp -r "${source_dir}/." "."
./configure \
--prefix=${prefix} \
--host=x86_64-astral \
--with-rcdir=/tmp/cupsinit \
--with-docdir=/usr/share/cups/doc \
--disable-dbus \
--disable-gssapi \
--disable-pam \
--disable-browsing \
--with-tls=no \
--with-components=libcups
sed -i s/-Werror//g Makedefs
}
build() {
make -j${parallelism}
}
package() {
make DESTDIR=${dest_dir} install -j${parallelism}
}
+18
View File
@@ -0,0 +1,18 @@
name=libxtst
revision=1
from_source=libxtst
imagedeps="build-essential"
hostdeps="xgcc xbinutils pkgconfig util-macros"
deps="base xorgproto libx11 libxext libxi"
configure() {
${source_dir}/configure --prefix=${prefix} --host=x86_64-astral --enable-shared --disable-static
}
build() {
make -j${parallelism}
}
package() {
make DESTDIR=${dest_dir} install
}
+35
View File
@@ -0,0 +1,35 @@
name=openjdk17
revision=1
from_source=openjdk17
imagedeps="build-essential zip unzip file"
hostdeps="xgcc xbinutils libstdc++-v3 pkgconfig autoconf host-openjdk-bin"
deps="base alsa-lib cups freetype fontconfig libpng libjpeg-turbo zlib libx11 libxext libxi libxrandr libxrender libxt libxtst xorgproto libiconv libffi"
allow_network="yes"
configure() {
# TODO: figure out why zlib.h is not found on system zlib
${source_dir}/configure \
--prefix=${prefix} \
--openjdk-target=x86_64-astral \
--disable-ccache \
--disable-precompiled-headers \
--disable-warnings-as-errors \
--enable-full-docs=no \
--with-boot-jdk="/usr/local" \
--with-freetype=system \
--with-libjpeg=system \
--with-libpng=system \
--with-zlib=bundled
}
build() {
make JOBS=${parallelism} product-images
}
package() {
mkdir -p images/jdk/.systemPrefs
touch images/jdk/.systemPrefs/.system.lock
touch images/jdk/.systemPrefs/.systemRootModFile
mkdir -p "${dest_dir}/usr/lib/jvm"
cp -pPr images/jdk "${dest_dir}/usr/lib/jvm/java-17"
}
+9
View File
@@ -0,0 +1,9 @@
name=alsa-lib
version=1.2.13
source_method=tarball
tarball_url="https://github.com/alsa-project/alsa-lib/archive/refs/tags/v${version}.tar.gz"
tarball_sha512=ae21380c75ab2f318b14d42b1f06e35d2a80b377fe0a12177e7f5c926b189bb242037891e3e7d780d77376e57d6f074abe5701eecd55035ff0498bdbca55e42a
hostdeps="autoconf automake util-macros pkgconfig libtool"
prepare() {
autoreconf -fvi
}
+9
View File
@@ -0,0 +1,9 @@
name=cups
version=2.4.11
source_method=tarball
tarball_url="https://github.com/OpenPrinting/cups/releases/download/v2.4.11/cups-2.4.11-source.tar.gz"
tarball_sha512=5868f069cb5eaa5c74e703ed7773914376fb819ebabd7881df8726092eab390c8a1db75c4d08377a836a87807765ad2c16a15b406ab0580fdda2b176e2da3162
hostdeps="automake autoconf"
prepare() {
cp -v $(find /usr/local/share/automake* -name config.sub) .
}
+5
View File
@@ -0,0 +1,5 @@
name=host-openjdk-bin
version=17.0.9.9
source_method=tarball
tarball_url="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jdk_x64_linux_hotspot_17.0.9_9.tar.gz"
tarball_blake2b=0bf5a6583f27a2d961fc72de11154e2fc6ba6383ebaf58fb328ea7ef40994188d1aee6fbdef5784f5629f552d6942c43e29fa3f7b99af250e4179da9bd7fcbe4
+9
View File
@@ -0,0 +1,9 @@
name=libxtst
version=1.2.5
source_method=tarball
tarball_url="https://www.x.org/archive/individual/lib/libXtst-${version}.tar.xz"
tarball_sha512="848fa580d7abccd48c9ca3440f92e299839ada0912ed60d38d4d4f5bf37431cd02d7059265ab4e524c3e2cb9c368b9b90b863d1ed97d74979ef8811fc5e635a9"
hostdeps="autoconf automake util-macros pkgconfig libtool"
prepare() {
autoreconf -fvi
}
+10
View File
@@ -0,0 +1,10 @@
name=openjdk17
version=17.0.35
source_method=tarball
tarball_url="https://github.com/openjdk/jdk17/archive/refs/tags/jdk-17+35.tar.gz"
tarball_sha512=c43fea864059ec2e5ca8c9ac96253cf429359774105842353c413a3bf0f4a348d6a2a4948f3a5a9af83667b0312b066002d5d5efa8234a37e2370b14ed6733df
hostdeps="autoconf automake pkgconfig libtool"
prepare() {
cp -v $(find /usr/local/share/automake* -name config.sub) make/autoconf/build-aux/
chmod +x configure
}