summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-02-08 12:59:13 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2013-02-08 12:59:13 +0100
commit86d94843cf4e7831dd118175d3814be037eb9056 (patch)
treeb4174ee53f691b43e17500cf64f5538dd47d666f /signal.c
parent28ac68f2ab90e85663ecedcf9b56847290cd1ed4 (diff)
downloadstrace-86d94843cf4e7831dd118175d3814be037eb9056.tar.gz
strace-86d94843cf4e7831dd118175d3814be037eb9056.tar.bz2
strace-86d94843cf4e7831dd118175d3814be037eb9056.tar.xz
Remove vestigial hacks around non-Linux struct sigactions
* signal.c: Stop using __sighandler_t glibc'ism. Remove SA_HANDLER macro. Explain why we can't use "sa_handler" as a field name. (sys_sigaction): Use __sa_handler instead of SA_HANDLER macro. (sys_rt_sigaction): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/signal.c b/signal.c
index 4dbf8b4..5fa07f6 100644
--- a/signal.c
+++ b/signal.c
@@ -774,16 +774,12 @@ sys_sigsetmask(struct tcb *tcp)
#ifdef HAVE_SIGACTION
struct old_sigaction {
- __sighandler_t __sa_handler;
+ /* sa_handler may be a libc #define, need to use other name: */
+ void (*__sa_handler)(int);
unsigned long sa_mask;
unsigned long sa_flags;
void (*sa_restorer)(void);
};
-#define SA_HANDLER __sa_handler
-
-#ifndef SA_HANDLER
-#define SA_HANDLER sa_handler
-#endif
int
sys_sigaction(struct tcb *tcp)
@@ -808,19 +804,19 @@ sys_sigaction(struct tcb *tcp)
/* Architectures using function pointers, like
* hppa, may need to manipulate the function pointer
* to compute the result of a comparison. However,
- * the SA_HANDLER function pointer exists only in
+ * the __sa_handler function pointer exists only in
* the address space of the traced process, and can't
* be manipulated by strace. In order to prevent the
* compiler from generating code to manipulate
- * SA_HANDLER we cast the function pointers to long. */
- if ((long)sa.SA_HANDLER == (long)SIG_ERR)
+ * __sa_handler we cast the function pointers to long. */
+ if ((long)sa.__sa_handler == (long)SIG_ERR)
tprints("{SIG_ERR, ");
- else if ((long)sa.SA_HANDLER == (long)SIG_DFL)
+ else if ((long)sa.__sa_handler == (long)SIG_DFL)
tprints("{SIG_DFL, ");
- else if ((long)sa.SA_HANDLER == (long)SIG_IGN)
+ else if ((long)sa.__sa_handler == (long)SIG_IGN)
tprints("{SIG_IGN, ");
else
- tprintf("{%#lx, ", (long) sa.SA_HANDLER);
+ tprintf("{%#lx, ", (long) sa.__sa_handler);
long_to_sigset(sa.sa_mask, &sigset);
printsigmask(&sigset, 0);
tprints(", ");
@@ -1266,9 +1262,10 @@ sys_rt_sigprocmask(struct tcb *tcp)
/* Structure describing the action to be taken when a signal arrives. */
struct new_sigaction
{
- __sighandler_t __sa_handler;
+ /* sa_handler may be a libc #define, need to use other name: */
+ void (*__sa_handler)(int);
unsigned long sa_flags;
- void (*sa_restorer) (void);
+ void (*sa_restorer)(void);
/* Kernel treats sa_mask as an array of longs. */
unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
};
@@ -1337,11 +1334,11 @@ sys_rt_sigaction(struct tcb *tcp)
/* Architectures using function pointers, like
* hppa, may need to manipulate the function pointer
* to compute the result of a comparison. However,
- * the SA_HANDLER function pointer exists only in
+ * the __sa_handler function pointer exists only in
* the address space of the traced process, and can't
* be manipulated by strace. In order to prevent the
* compiler from generating code to manipulate
- * SA_HANDLER we cast the function pointers to long. */
+ * __sa_handler we cast the function pointers to long. */
if ((long)sa.__sa_handler == (long)SIG_ERR)
tprints("{SIG_ERR, ");
else if ((long)sa.__sa_handler == (long)SIG_DFL)