ladybird/Ports/bdwgc/patches/0004-Teach-bdwgc-about-serenity-signals.patch
2023-03-27 14:27:32 +01:00

64 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Mon, 27 Mar 2023 20:10:51 +1100
Subject: [PATCH] Teach bdwgc about serenity signals
Serenity doesn't have the realtime POSIX signals, so use SIGXCPU and
SIGXFSZ instead.
---
include/gc_config_macros.h | 4 +++-
include/private/gc_priv.h | 2 +-
pthread_stop_world.c | 4 +++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h
index 3bbc5fe..da783ce 100644
--- a/include/gc_config_macros.h
+++ b/include/gc_config_macros.h
@@ -73,7 +73,7 @@
#if defined(GC_AIX_THREADS) || defined(GC_DARWIN_THREADS) \
|| defined(GC_DGUX386_THREADS) || defined(GC_FREEBSD_THREADS) \
- || defined(GC_HPUX_THREADS) \
+ || defined(GC_HPUX_THREADS) || defined(GC_SERENITY_THREADS) \
|| defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
|| defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \
|| defined(GC_OSF1_THREADS) || defined(GC_SOLARIS_THREADS) \
@@ -84,6 +84,8 @@
#elif defined(GC_THREADS)
# if defined(__linux__)
# define GC_LINUX_THREADS
+# elif defined(__serenity__)
+# define GC_SERENITY_THREADS
# elif defined(__OpenBSD__)
# define GC_OPENBSD_THREADS
# elif defined(_PA_RISC1_1) || defined(_PA_RISC2_0) || defined(hppa) \
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index b26543e..23e911e 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -2985,7 +2985,7 @@ GC_INNER void *GC_store_debug_info_inner(void *p, word sz, const char *str,
&& !defined(GC_USESIGRT_SIGNALS)
# define SIG_SUSPEND SIGUSR1
/* SIGTSTP and SIGCONT could be used alternatively on FreeBSD. */
-# elif defined(GC_OPENBSD_THREADS) && !defined(GC_USESIGRT_SIGNALS)
+# elif (defined(GC_OPENBSD_THREADS) && !defined(GC_USESIGRT_SIGNALS)) || defined(GC_SERENITY_THREADS)
# ifndef GC_OPENBSD_UTHREADS
# define SIG_SUSPEND SIGXFSZ
# endif
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index b865d30..f0cf1a6 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -165,7 +165,9 @@ STATIC volatile AO_t GC_world_is_stopped = FALSE;
* pointer(s) and acknowledge.
*/
#ifndef SIG_THR_RESTART
-# if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) \
+# if defined(SERENITY)
+# define SIG_THR_RESTART SIGUSR1
+# elif defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) \
|| defined(GC_NETBSD_THREADS) || defined(GC_USESIGRT_SIGNALS)
# if defined(_SIGRTMIN) && !defined(CPPCHECK)
# define SIG_THR_RESTART _SIGRTMIN + 5