summaryrefslogtreecommitdiffstats
path: root/package/strace/strace-0001-sigaction-wrap-sa_restorer-in-ifdef-SA_RESTORER-cons.patch
blob: cd2e31b998fe5242343a34d31bd90592059730aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Add a patch to fix the sa_restorer problems in strace.

This patch has been applied upstream:
  https://sourceforge.net/p/strace/code/ci/c3a5c01051ba29a9f421f4d45d96bbc32df2b796/

Signed-off-by: Vicente Olivert Riera <vincent.riera@imgtec.com>

From c3a5c01051ba29a9f421f4d45d96bbc32df2b796 Mon Sep 17 00:00:00 2001
From: Vicente Olivert Riera <vincent@gentoo.org>
Date: Thu, 11 Sep 2014 20:05:18 +0100
Subject: [PATCH] sigaction: wrap sa_restorer in #ifdef SA_RESTORER consistently

Wrap sa_restorer member definitions in #ifdef SA_RESTORER to be
consistent with their use.
If an architecture does not provide sa_restorer members but still
defines SA_RESTORER macro, the latter has to be explicitly undefined.

This change fixes compilation failures like this one:
signal.c: In function 'decode_old_sigaction':
signal.c:631:21: error: 'struct old_sigaction' has no member named 'sa_restorer'
signal.c: In function 'decode_new_sigaction':
signal.c:1224:21: error: 'struct new_sigaction' has no member named 'sa_restorer'

* signal.c (struct old_sigaction, struct old_sigaction32,
struct new_sigaction, struct new_sigaction32):
Wrap sa_restorer member in #ifdef SA_RESTORER.
(decode_old_sigaction, decode_new_sigaction):
Wrap use of sa32.sa_restorer in #ifdef SA_RESTORER.

Signed-off-by: Vicente Olivert Riera <vincent.riera@imgtec.com>
---
 signal.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/signal.c b/signal.c
index 74e0fd9..5855d13 100644
--- a/signal.c
+++ b/signal.c
@@ -559,8 +559,10 @@ struct old_sigaction {
 	void (*__sa_handler)(int);
 	unsigned long sa_mask;
 	unsigned long sa_flags;
-	void (*sa_restorer)(void);
 #endif /* !MIPS */
+#ifdef SA_RESTORER
+	void (*sa_restorer)(void);
+#endif
 };
 
 struct old_sigaction32 {
@@ -568,7 +570,9 @@ struct old_sigaction32 {
 	uint32_t __sa_handler;
 	uint32_t sa_mask;
 	uint32_t sa_flags;
+#ifdef SA_RESTORER
 	uint32_t sa_restorer;
+#endif
 };
 
 static void
@@ -594,7 +598,9 @@ decode_old_sigaction(struct tcb *tcp, long addr)
 			memset(&sa, 0, sizeof(sa));
 			sa.__sa_handler = (void*)(uintptr_t)sa32.__sa_handler;
 			sa.sa_flags = sa32.sa_flags;
+#ifdef SA_RESTORER
 			sa.sa_restorer = (void*)(uintptr_t)sa32.sa_restorer;
+#endif
 			sa.sa_mask = sa32.sa_mask;
 		}
 	} else
@@ -1138,10 +1144,10 @@ struct new_sigaction
 #else
 	void (*__sa_handler)(int);
 	unsigned long sa_flags;
-# if !defined(ALPHA) && !defined(HPPA) && !defined(IA64)
-	void (*sa_restorer)(void);
-# endif /* !ALPHA && !HPPA && !IA64 */
 #endif /* !MIPS */
+#ifdef SA_RESTORER
+	void (*sa_restorer)(void);
+#endif
 	/* Kernel treats sa_mask as an array of longs. */
 	unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
 };
@@ -1150,7 +1156,9 @@ struct new_sigaction32
 {
 	uint32_t __sa_handler;
 	uint32_t sa_flags;
+#ifdef SA_RESTORER
 	uint32_t sa_restorer;
+#endif
 	uint32_t sa_mask[2 * (NSIG / sizeof(long) ? NSIG / sizeof(long) : 1)];
 };
 
@@ -1176,7 +1184,9 @@ decode_new_sigaction(struct tcb *tcp, long addr)
 			memset(&sa, 0, sizeof(sa));
 			sa.__sa_handler = (void*)(unsigned long)sa32.__sa_handler;
 			sa.sa_flags     = sa32.sa_flags;
+#ifdef SA_RESTORER
 			sa.sa_restorer  = (void*)(unsigned long)sa32.sa_restorer;
+#endif
 			/* Kernel treats sa_mask as an array of longs.
 			 * For 32-bit process, "long" is uint32_t, thus, for example,
 			 * 32th bit in sa_mask will end up as bit 0 in sa_mask[1].
-- 
1.7.1

OpenPOWER on IntegriCloud