From 5ee63d9b7d7c49aaa0a4c22c56a113f0b5d59378 Mon Sep 17 00:00:00 2001 From: Jiwon Na Date: Fri, 2 Jan 2026 09:36:56 +0900 Subject: [PATCH] illumos build fix --- cutils.h | 4 ++++ qjs.c | 2 ++ quickjs-libc.c | 5 +++++ quickjs.c | 7 ++++++- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/cutils.h b/cutils.h index 094a8f1..eb650b9 100644 --- a/cutils.h +++ b/cutils.h @@ -29,6 +29,10 @@ #include #include +#if defined(__sun) +#undef __maybe_unused +#endif + #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #define force_inline inline __attribute__((always_inline)) diff --git a/qjs.c b/qjs.c index 0224f7c..9486965 100644 --- a/qjs.c +++ b/qjs.c @@ -143,6 +143,8 @@ static size_t js_trace_malloc_usable_size(const void *ptr) return 0; #elif defined(__linux__) || defined(__GLIBC__) return malloc_usable_size((void *)ptr); +#elif defined(__sun) + return 0; #else /* change this to `return 0;` if compilation fails */ return malloc_usable_size((void *)ptr); diff --git a/quickjs-libc.c b/quickjs-libc.c index c24b6d5..d097689 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -62,6 +62,11 @@ typedef sig_t sighandler_t; #endif #endif /* __APPLE__ */ +#ifdef __sun +typedef void (*sighandler_t)(int); +extern char **environ; +#endif + #endif /* enable the os.Worker API. It relies on POSIX threads */ diff --git a/quickjs.c b/quickjs.c index e30d393..f8e21da 100644 --- a/quickjs.c +++ b/quickjs.c @@ -39,6 +39,9 @@ #elif defined(__FreeBSD__) #include #endif +#if defined(__sun) +#include +#endif #include "cutils.h" #include "list.h" @@ -1725,6 +1728,8 @@ static size_t js_def_malloc_usable_size(const void *ptr) return 0; #elif defined(__linux__) || defined(__GLIBC__) return malloc_usable_size((void *)ptr); +#elif defined(__sun) + return 0; #else /* change this to `return 0;` if compilation fails */ return malloc_usable_size((void *)ptr); @@ -46788,7 +46793,7 @@ static int getTimezoneOffset(int64_t time) } } ti = time; -#if defined(_WIN32) +#if defined(_WIN32) || defined(__sun) { struct tm *tm; time_t gm_ti, loc_ti;