+2004-03-07 Paul Eggert <eggert@twinsun.com>
+
+ * c-stack.c (SIGACTION_WORKS): New macro. Use it instead of long
+ '#if' expressions. Unlike the code it replaces, it it does not
+ depend on (defined _SC_PAGESIZE). However, it does depend on
+ HAVE_STRUCT_SIGACTION_SA_SIGACTION; this last change fixes a bug
+ first reported by Jason Andrade in
+ <http://mail.gnu.org/archive/html/bug-textutils/2003-03/msg00027.html>.
+
2004-01-18 Simon Josefsson <jas@extundo.com>
* strdup.h: New file.
#include "c-stack.h"
#include "exitfail.h"
+#if (HAVE_STRUCT_SIGACTION_SA_SIGACTION && defined SA_NODEFER \
+ && defined SA_ONSTACK && defined SA_RESETHAND && defined SA_SIGINFO)
+# define SIGACTION_WORKS 1
+#else
+# define SIGACTION_WORKS 0
+#endif
+
extern char *program_name;
/* The user-specified action to take when a SEGV-related program error
void *p;
} alternate_signal_stack;
-# if defined SA_ONSTACK && defined SA_SIGINFO && defined _SC_PAGESIZE
+# if SIGACTION_WORKS
/* Handle a segmentation violation and exit. This function is
async-signal-safe. */
stack_overflow_message = _("stack overflow");
{
-# if ! (defined SA_ONSTACK && defined SA_SIGINFO && defined _SC_PAGESIZE)
- return signal (SIGSEGV, die) == SIG_ERR ? -1 : 0;
-# else
+# if SIGACTION_WORKS
struct sigaction act;
sigemptyset (&act.sa_mask);
act.sa_sigaction = segv_handler;
return sigaction (SIGSEGV, &act, 0);
+# else
+ return signal (SIGSEGV, die) == SIG_ERR ? -1 : 0;
# endif
}
}
+2004-03-07 Paul Eggert <eggert@twinsun.com>
+
+ * c-stack.m4 (gl_PREREQ_C_STACK): Renamed from jm_PREREQ_C_STACK.
+ All uses changed. Check for sa_sigaction member; this fixes
+ a bug first reported by Jason Andrade in
+ <http://mail.gnu.org/archive/html/bug-textutils/2003-03/msg00027.html>.
+
2004-01-18 Simon Josefsson <jas@extundo.com>
* strdup.m4 (gl_PREREQ_STRDUP): Check whether strdup is declared.
# Check prerequisites for compiling lib/c-stack.c.
-# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
fi])
-AC_DEFUN([jm_PREREQ_C_STACK],
+AC_DEFUN([gl_PREREQ_C_STACK],
[AC_REQUIRE([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC])
# for STACK_DIRECTION
AC_CHECK_HEADERS_ONCE(sys/time.h unistd.h)
AC_CHECK_HEADERS(sys/resource.h ucontext.h)
+ AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , , [#include <signal.h>])
+
AC_CHECK_TYPES([stack_t], , , [#include <signal.h>])])
AC_DEFUN([gl_C_STACK],
[
dnl Prerequisites of lib/c-stack.c.
- jm_PREREQ_C_STACK
+ gl_PREREQ_C_STACK
])