+2007-08-14 Hans Boehm <Hans.Boehm@hp.com> (really mostly Samuel Thibault)
+
+ * dbg_mlc.c: Use random() on all glibc systems.
+ * mach_dep.c (GC_with_callee_saves_pushed): Don't use getcontext() on
+ HURD. Add comment.
+ * pthread_stop_world.c (GC_suspend_handler, GC_stop_init): Accomodate
+ systems without SA_SIGINFO.
+
2007-08-14 Hans Boehm <Hans.Boehm@hp.com> (partly really Henrik Theiling)
* include/gc.h (GC_PTR_STORE): Fix non-DEBUG parentheses.
# if defined(HAVE_PUSH_REGS)
GC_push_regs();
-# elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32)
+# elif defined(UNIX_LIKE) && !defined(DARWIN) && !defined(ARM32) && \
+ !defined(HURD)
/* Older versions of Darwin seem to lack getcontext(). */
/* ARM Linux often doesn't support a real getcontext(). */
ucontext_t ctxt;
/* _setjmp won't, but is less portable. */
# endif
# endif /* !HAVE_PUSH_REGS ... */
+ /* FIXME: context here is sometimes just zero. At the moment the callees */
+ /* don't really need it. */
fn(arg, context);
/* Strongly discourage the compiler from treating the above */
/* as a tail-call, since that would pop the register */
void GC_suspend_handler_inner(ptr_t sig_arg, void *context);
#if defined(IA64) || defined(HP_PA) || defined(M68K)
+#ifdef SA_SIGINFO
void GC_suspend_handler(int sig, siginfo_t *info, void *context)
+#else
+void GC_suspend_handler(int sig)
+#endif
{
int old_errno = errno;
GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig);
#else
/* We believe that in all other cases the full context is already */
/* in the signal handler frame. */
+#ifdef SA_SIGINFO
void GC_suspend_handler(int sig, siginfo_t *info, void *context)
+#else
+void GC_suspend_handler(int sig)
+#endif
{
int old_errno = errno;
+# ifndef SA_SIGINFO
+ void *context = 0;
+# endif
GC_suspend_handler_inner((ptr_t)(word)sig, context);
errno = old_errno;
}
ABORT("sem_init failed");
# endif
- act.sa_flags = SA_RESTART | SA_SIGINFO;
+ act.sa_flags = SA_RESTART
+# ifdef SA_SIGINFO
+ | SA_SIGINFO
+# endif
+ ;
if (sigfillset(&act.sa_mask) != 0) {
ABORT("sigfillset() failed");
}
GC_remove_allowed_signals(&act.sa_mask);
/* SIG_THR_RESTART is set in the resulting mask. */
/* It is unmasked by the handler when necessary. */
+# ifdef SA_SIGINFO
act.sa_sigaction = GC_suspend_handler;
+# else
+ act.sa_handler = GC_suspend_handler;
+# endif
if (sigaction(SIG_SUSPEND, &act, NULL) != 0) {
ABORT("Cannot set SIG_SUSPEND handler");
}
+# ifdef SA_SIGINFO
act.sa_flags &= ~ SA_SIGINFO;
+# endif
act.sa_handler = GC_restart_handler;
if (sigaction(SIG_THR_RESTART, &act, NULL) != 0) {
ABORT("Cannot set SIG_THR_RESTART handler");