]> granicus.if.org Git - gc/commitdiff
Extend new suspend/restart signal macro redirection to other OSes beyond Linux.
authorJean-Claude Beaudoin <jean.claude.beaudoin@gmail.com>
Tue, 3 Jul 2012 01:36:10 +0000 (21:36 -0400)
committerJean-Claude Beaudoin <jean.claude.beaudoin@gmail.com>
Tue, 3 Jul 2012 01:36:10 +0000 (21:36 -0400)
include/private/gc_priv.h
include/private/gcconfig.h
pthread_stop_world.c

index 578a1e2bdb1ecd3919d59baf0cd1879f001b3b02..336d07cddfef88f584c9f41db7926dc35a2e3907 100644 (file)
@@ -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 <signal.h>.      */
       /* 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 */
index aff7874076ffd3c5c6055d1474dcb852b2af8cf0..6e4a38b6bcf622a9f5de13e737d77c3d20f2a350 100644 (file)
 #       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
 #   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
 #           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
 #       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"
 #     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))
 #   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__
 #           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
index 3723fd8199895153b7822ec96fe77042556c288e..7fe4069ee82a21e1583e97749fe94197ff4a4e23 100644 (file)
@@ -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