From: Jean-Claude Beaudoin Date: Tue, 3 Jul 2012 01:36:10 +0000 (-0400) Subject: Extend new suspend/restart signal macro redirection to other OSes beyond Linux. X-Git-Tag: gc7_4_0~261^2^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76f071ba2adb9433b417555f09ece585f536a15b;p=gc Extend new suspend/restart signal macro redirection to other OSes beyond Linux. --- diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 578a1e2b..336d07cd 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -2283,7 +2283,8 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str, # if defined(SPARC) && !defined(SIGPWR) /* SPARC/Linux doesn't properly define SIGPWR in . */ /* It is aliased to SIGLOST in asm/signal.h, though. */ -# define SIG_SUSPEND SIGLOST +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_SUSPEND_DEFAULT SIGLOST # else /* Linuxthreads itself uses SIGUSR1 and SIGUSR2. */ # define SIG_SUSPEND GC_get_suspend_signal() @@ -2292,10 +2293,11 @@ GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str, # define SIG_THR_RESTART_DEFAULT SIGXCPU # endif # elif !defined(GC_OPENBSD_THREADS) && !defined(GC_DARWIN_THREADS) +# define SIG_SUSPEND GC_get_suspend_signal() # if defined(_SIGRTMIN) -# define SIG_SUSPEND _SIGRTMIN + 6 +# define SIG_SUSPEND_DEFAULT _SIGRTMIN + 6 # else -# define SIG_SUSPEND SIGRTMIN + 6 +# define SIG_SUSPEND_DEFAULT SIGRTMIN + 6 # endif # endif #endif /* GC_PTHREADS && !SIG_SUSPEND */ diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index aff78740..6e4a38b6 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -900,8 +900,10 @@ # ifndef GC_FREEBSD_THREADS # define MPROTECT_VDB # endif -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_THR_RESTART GC_get_thr_restart_signal() +# define SIG_SUSPEND_DEFAULT SIGUSR1 +# define SIG_THR_RESTART_DEFAULT SIGUSR2 # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING @@ -1102,8 +1104,10 @@ # endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_THR_RESTART GC_get_thr_restart_signal() +# define SIG_SUSPEND_DEFAULT SIGUSR1 +# define SIG_THR_RESTART_DEFAULT SIGUSR2 # define FREEBSD_STACKBOTTOM # ifdef __ELF__ # define DYNAMIC_LOADING @@ -1371,13 +1375,17 @@ # define MPROTECT_VDB # endif # ifdef __GLIBC__ -# define SIG_SUSPEND (32+6) -# define SIG_THR_RESTART (32+5) +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_THR_RESTART GC_get_thr_restart_signal() +# define SIG_SUSPEND_DEFAULT (32+6) +# define SIG_THR_RESTART_DEFAULT (32+5) extern int _end[]; # define DATAEND (ptr_t)(_end) # else -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_THR_RESTART GC_get_thr_restart_signal() +# define SIG_SUSPEND_DEFAULT SIGUSR1 +# define SIG_THR_RESTART_DEFAULT SIGUSR2 /* SIGTSTP and SIGCONT could be used alternatively. */ # endif # define FREEBSD_STACKBOTTOM @@ -1423,8 +1431,10 @@ # define DATASTART ((ptr_t)etext) # define DATAEND ((ptr_t)end) # define STACKBOTTOM ((ptr_t)InitStackBottom) -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_THR_RESTART GC_get_thr_restart_signal() +# define SIG_SUSPEND_DEFAULT SIGUSR1 +# define SIG_THR_RESTART_DEFAULT SIGUSR2 # endif # ifdef DOS4GW # define OS_TYPE "DOS4GW" @@ -1445,8 +1455,10 @@ # define OS_TYPE "HURD" # define STACK_GROWS_DOWN # define HEURISTIC2 -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_THR_RESTART GC_get_thr_restart_signal() +# define SIG_SUSPEND_DEFAULT SIGUSR1 +# define SIG_THR_RESTART_DEFAULT SIGUSR2 # define SEARCH_FOR_DATA_START extern int _end[]; # define DATAEND ((ptr_t) (_end)) @@ -1715,8 +1727,10 @@ # ifdef FREEBSD # define OS_TYPE "FREEBSD" /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */ -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_THR_RESTART GC_get_thr_restart_signal() +# define SIG_SUSPEND_DEFAULT SIGUSR1 +# define SIG_THR_RESTART_DEFAULT SIGUSR2 /* SIGTSTP and SIGCONT could be used alternatively. */ # define FREEBSD_STACKBOTTOM # ifdef __ELF__ @@ -2209,13 +2223,17 @@ # define MPROTECT_VDB # endif # ifdef __GLIBC__ -# define SIG_SUSPEND (32+6) -# define SIG_THR_RESTART (32+5) +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_THR_RESTART GC_get_thr_restart_signal() +# define SIG_SUSPEND_DEFAULT (32+6) +# define SIG_THR_RESTART_DEFAULT (32+5) extern int _end[]; # define DATAEND (ptr_t)(_end) # else -# define SIG_SUSPEND SIGUSR1 -# define SIG_THR_RESTART SIGUSR2 +# define SIG_SUSPEND GC_get_suspend_signal() +# define SIG_THR_RESTART GC_get_thr_restart_signal() +# define SIG_SUSPEND_DEFAULT SIGUSR1 +# define SIG_THR_RESTART_DEFAULT SIGUSR2 /* SIGTSTP and SIGCONT could be used alternatively. */ # endif # define FREEBSD_STACKBOTTOM diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 3723fd81..7fe4069e 100644 --- a/pthread_stop_world.c +++ b/pthread_stop_world.c @@ -129,15 +129,16 @@ STATIC volatile AO_t GC_world_is_stopped = FALSE; */ #ifndef SIG_THR_RESTART +# define SIG_THR_RESTART GC_get_thr_restart_signal() # if defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) \ || defined(GC_NETBSD_THREADS) # ifdef _SIGRTMIN -# define SIG_THR_RESTART _SIGRTMIN + 5 +# define SIG_THR_RESTART_DEFAULT _SIGRTMIN + 5 # else -# define SIG_THR_RESTART SIGRTMIN + 5 +# define SIG_THR_RESTART_DEFAULT SIGRTMIN + 5 # endif # else -# define SIG_THR_RESTART SIGXCPU +# define SIG_THR_RESTART_DEFAULT SIGXCPU # endif #endif