bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] c-stack fix for IRIX 5.3


From: Paul Eggert
Subject: [Bug-gnulib] c-stack fix for IRIX 5.3
Date: Sun, 07 Mar 2004 15:54:02 -0800
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (usg-unix-v)

I installed the following patch to c-stack.c, to work around a
portability problem to IRIX 5.3 recently reported by a Bison user (and
also reported last April by an old textutils user).

Index: lib/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/ChangeLog,v
retrieving revision 1.640
diff -p -u -r1.640 ChangeLog
--- lib/ChangeLog       25 Feb 2004 19:45:31 -0000      1.640
+++ lib/ChangeLog       7 Mar 2004 23:50:02 -0000
@@ -1,3 +1,12 @@
+2004-03-07  Paul Eggert  <address@hidden>
+
+       * 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  <address@hidden>
 
        * strdup.h: New file.
Index: lib/c-stack.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/c-stack.c,v
retrieving revision 1.4
diff -p -u -r1.4 c-stack.c
--- lib/c-stack.c       18 Jan 2004 09:32:50 -0000      1.4
+++ lib/c-stack.c       7 Mar 2004 23:50:02 -0000
@@ -91,6 +91,13 @@ typedef struct sigaltstack stack_t;
 #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
@@ -153,7 +160,7 @@ static union
   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.  */
@@ -238,9 +245,7 @@ c_stack_action (void (*action) (int))
   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);
 
@@ -252,6 +257,8 @@ c_stack_action (void (*action) (int))
     act.sa_sigaction = segv_handler;
 
     return sigaction (SIGSEGV, &act, 0);
+# else
+    return signal (SIGSEGV, die) == SIG_ERR ? -1 : 0;
 # endif
   }
 }
Index: m4/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/ChangeLog,v
retrieving revision 1.530
diff -p -u -r1.530 ChangeLog
--- m4/ChangeLog        25 Feb 2004 19:39:07 -0000      1.530
+++ m4/ChangeLog        7 Mar 2004 23:50:04 -0000
@@ -1,3 +1,10 @@
+2004-03-07  Paul Eggert  <address@hidden>
+
+       * 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  <address@hidden>
 
        * strdup.m4 (gl_PREREQ_STRDUP): Check whether strdup is declared.
Index: m4/c-stack.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/c-stack.m4,v
retrieving revision 1.3
diff -p -u -r1.3 c-stack.m4
--- m4/c-stack.m4       17 Aug 2003 00:09:27 -0000      1.3
+++ m4/c-stack.m4       7 Mar 2004 23:50:04 -0000
@@ -1,6 +1,6 @@
 # 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
@@ -138,7 +138,7 @@ AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEUR
    fi])
 
 
-AC_DEFUN([jm_PREREQ_C_STACK],
+AC_DEFUN([gl_PREREQ_C_STACK],
   [AC_REQUIRE([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC])
 
    # for STACK_DIRECTION
@@ -151,10 +151,12 @@ AC_DEFUN([jm_PREREQ_C_STACK],
    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
 ])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]