[PATCH] Add configuration to detect toolset has sigaltstack() prototype

Joel Sherrill joel.sherrill at oarcorp.com
Wed Aug 20 23:48:32 UTC 2014


With the recent addition of a prototype for sigaltstack() and
associated data structures to newlib, the declaration in
rtems_bsdnet_internal.h is no longer needed. But to ease the
transition, I added an autoconf probe to determine if it
was needed or not.

After 4.11, I would like to rip this and and <sys/cpuset.h>
checks out.

---
 cpukit/configure.ac                                | 12 ++++++++++++
 cpukit/libnetworking/rtems/rtems_bsdnet_internal.h | 10 ++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/cpukit/configure.ac b/cpukit/configure.ac
index 56815e2..fcf3437 100644
--- a/cpukit/configure.ac
+++ b/cpukit/configure.ac
@@ -116,6 +116,12 @@ RTEMS_CHECK_FUNC([pthread_getattr_np],[
   #include <pthread.h>])
 AC_CHECK_HEADERS([sys/cpuset.h])
 
+# This was added to newlib in August 2014 to improve conformance.
+# Disable use of internal definition if it is present.
+RTEMS_CHECK_FUNC([sigaltstack],[
+  #define _GNU_SOURCE
+  #include <signal.h>])
+
 # Mandated by POSIX, not declared in some versions of newlib.
 AC_CHECK_DECLS([getrusage],,,[#include sys/resource.h])
 
@@ -236,6 +242,12 @@ RTEMS_CPUOPT([__RTEMS_HAVE_SYS_CPUSET_H__],
   [1],
   [indicate if <sys/cpuset.h> is present in toolset])
 
+## Header file differences that need to be known in .h after install
+RTEMS_CPUOPT([__RTEMS_HAVE_DECL_SIGALTSTACK__],
+  [test x"${ac_cv_have_decl_sigaltstack}" = x"yes"],
+  [1],
+  [indicate if <signal.h> in toolset has sigaltstack()])
+
 ## This improves both the size and coverage analysis.
 RTEMS_CPUOPT([__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__],
   [test x"${RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH}" = x"1"],
diff --git a/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h b/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
index 05e54b2..567cc8a 100644
--- a/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
+++ b/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h
@@ -83,11 +83,13 @@ typedef	quad_t *	qaddr_t;
 typedef void __sighandler_t(int);
 typedef	__sighandler_t	*sig_t;	/* type of pointer to a signal function */
 #define NSIG    32
-struct	sigaltstack {
-	char	*ss_sp;			/* signal stack base */
-	int	ss_size;		/* signal stack length */
-	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */
+#if (__RTEMS_HAVE_DECL_SIGALTSTACK__ == 0)
+struct sigaltstack {
+       char    *ss_sp;                 /* signal stack base */
+       int     ss_size;                /* signal stack length */
+       int     ss_flags;               /* SS_DISABLE and/or SS_ONSTACK */
 };
+#endif
 
 #ifdef _KERNEL
 typedef	int		boolean_t;
-- 
1.9.3



More information about the devel mailing list