[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c-stack tests
From: |
Eric Blake |
Subject: |
Re: c-stack tests |
Date: |
Tue, 17 Jun 2008 17:35:33 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
>
> I'm committing this to give c-stack better testsuite exposure.
And this followup, to reduce the time spent in configure.
From: Eric Blake <address@hidden>
Date: Tue, 17 Jun 2008 11:07:45 -0600
Subject: [PATCH] Simplify c-stack prerequisites.
* lib/c-stack.c (includes): Remove unused <sys/resource.h>.
* m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Posix 200x
no longer requires <ucontext.h> to exist. Optimize setrlimit
check.
(gl_PREREQ_C_STACK): Remove check for unused getcontext and
<sys/resource.h>.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 8 ++++++++
lib/c-stack.c | 12 ++----------
m4/c-stack.m4 | 21 ++++++++++++---------
3 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 80c51b8..83af7de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2008-06-17 Eric Blake <address@hidden>
+ Simplify c-stack prerequisites.
+ * lib/c-stack.c (includes): Remove unused <sys/resource.h>.
+ * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Posix 200x
+ no longer requires <ucontext.h> to exist. Optimize setrlimit
+ check.
+ (gl_PREREQ_C_STACK): Remove check for unused getcontext and
+ <sys/resource.h>.
+
Move c-stack test into testsuite.
* modules/c-stack-tests: New file.
* lib/c-stack.c [DEBUG]: Move test program...
diff --git a/lib/c-stack.c b/lib/c-stack.c
index 7129036..ff892c5 100644
--- a/lib/c-stack.c
+++ b/lib/c-stack.c
@@ -57,16 +57,8 @@ typedef struct sigaltstack stack_t;
#include <stdlib.h>
#include <string.h>
-#if HAVE_SYS_RESOURCE_H
-/* Include sys/time.h here, because...
- SunOS-4.1.x <sys/resource.h> fails to include <sys/time.h>.
- This gives "incomplete type" errors for ru_utime and tu_stime. */
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# endif
-# include <sys/resource.h>
-#endif
-
+/* Posix 2001 declares ucontext_t in <ucontext.h>, Posix 200x in
+ <signal.h>. */
#if HAVE_UCONTEXT_H
# include <ucontext.h>
#endif
diff --git a/m4/c-stack.m4 b/m4/c-stack.m4
index 3604fa1..f142171 100644
--- a/m4/c-stack.m4
+++ b/m4/c-stack.m4
@@ -1,16 +1,19 @@
# Check prerequisites for compiling lib/c-stack.c.
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# Written by Paul Eggert.
+# serial 2
+
AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC],
[# for STACK_DIRECTION
AC_REQUIRE([AC_FUNC_ALLOCA])
- AC_CHECK_FUNCS(setrlimit)
+ AC_CHECK_FUNCS_ONCE([setrlimit])
+ AC_CHECK_HEADERS_ONCE([ucontext.h])
AC_CACHE_CHECK([for working C stack overflow detection],
ac_cv_sys_xsi_stack_overflow_heuristic,
@@ -18,7 +21,9 @@ AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC],
[
#include <unistd.h>
#include <signal.h>
- #include <ucontext.h>
+ #if HAVE_UCONTEXT_H
+ # include <ucontext.h>
+ #endif
#if HAVE_SETRLIMIT
# include <sys/types.h>
# include <sys/time.h>
@@ -120,9 +125,9 @@ AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC],
a SIGSEGV, and an alternate stack can be established with sigaltstack,
and the signal handler is passed a context that specifies the
run time stack. This behavior is defined by POSIX 1003.1-2001
- with the X/Open System Interface (XSI) option
+ with the X/Open System Interface (XSI) option
and is a standardized way to implement a SEGV-based stack
- overflow detection heuristic.])
+ overflow detection heuristic.])
fi])
@@ -132,12 +137,10 @@ AC_DEFUN([gl_PREREQ_C_STACK],
# for STACK_DIRECTION
AC_REQUIRE([AC_FUNC_ALLOCA])
- AC_CHECK_FUNCS(getcontext sigaltstack)
- AC_CHECK_DECLS([getcontext], , , [#include <ucontext.h>])
+ AC_CHECK_FUNCS_ONCE([sigaltstack])
AC_CHECK_DECLS([sigaltstack], , , [#include <signal.h>])
- AC_CHECK_HEADERS_ONCE(sys/time.h unistd.h)
- AC_CHECK_HEADERS(sys/resource.h ucontext.h)
+ AC_CHECK_HEADERS_ONCE([unistd.h ucontext.h])
AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , , [#include <signal.h>])
--
1.5.5.1
- c-stack tests, Eric Blake, 2008/06/17
- Re: c-stack tests,
Eric Blake <=