[PATCH] Add typedef of stack_t for Cygwin

Jon TURNEY jon.turney@dronecode.org.uk
Tue Mar 31 23:29:00 GMT 2015


On 31/03/2015 16:47, Joel Sherrill wrote:
> Why can't you move the definition that is there for RTEMS and use
> it for both Cygwin and RTEMS? We have exactly the same definition
> only a few lines above.
>
> There is no point in duplicating this and when Cygwin and RTEMS
> can use exactly the same code, I am personally much happier.

Ok.  Attached patch is revised as you suggest.

I'm sorry I have no way to test this with RTEMS.


-------------- next part --------------
From afdee8a74fe6f86bd6b32223ecd4458dfa251875 Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.turney@dronecode.org.uk>
Date: Wed, 1 Apr 2015 00:12:07 +0100
Subject: [PATCH] Make stack_t typedef also available for Cygwin

	* libc/include/sys/signal.h (stack_t): Make typedef also available
	on Cygwin.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
 newlib/ChangeLog                 |  5 +++++
 newlib/libc/include/sys/signal.h | 20 +++++++++++---------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index e615421..ae5cb19 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-01  Jon TURNEY  <jon.turney@dronecode.org.uk>
+
+	* libc/include/sys/signal.h (stack_t): Make typedef also available
+	on Cygwin.
+
 2015-03-31  Corinna Vinschen  <vinschen@redhat.com>
 
 	* libc/time/lcltime_r.c (localtime_r): Call _tzset_unlocked inside
diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
index 7fc30a7..23ec9ad 100644
--- a/newlib/libc/include/sys/signal.h
+++ b/newlib/libc/include/sys/signal.h
@@ -125,15 +125,6 @@ struct sigaction {
  */
 #define	SS_ONSTACK	0x1
 #define	SS_DISABLE	0x2
-
-/*
- * Structure used in sigaltstack call.
- */
-typedef struct sigaltstack {
-  void     *ss_sp;    /* Stack base or pointer.  */
-  int       ss_flags; /* Flags.  */
-  size_t    ss_size;  /* Stack size.  */
-} stack_t;
 #endif
 
 #elif defined(__CYGWIN__)
@@ -151,6 +142,17 @@ struct sigaction
 };
 #endif /* defined(__rtems__) */
 
+#if defined(__CYGWIN__) || defined(__rtems__)
+/*
+ * Structure used in sigaltstack call.
+ */
+typedef struct sigaltstack {
+  void     *ss_sp;    /* Stack base or pointer.  */
+  int       ss_flags; /* Flags.  */
+  size_t    ss_size;  /* Stack size.  */
+} stack_t;
+#endif
+
 #define SIG_SETMASK 0	/* set mask with sigprocmask() */
 #define SIG_BLOCK 1	/* set of signals to block */
 #define SIG_UNBLOCK 2	/* set of signals to, well, unblock */
-- 
2.1.4



More information about the Newlib mailing list