summaryrefslogtreecommitdiff
path: root/signal.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-03-19 09:36:42 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2012-03-19 09:36:42 +0100
commit9fd4f96d2a2527ac7ca90c156bfc11ce10118684 (patch)
tree28fc6ab201afec903b58fad7b21dcaf57085af9f /signal.c
parent1be02798f56f3ee940c9cbc047be627fd12eef16 (diff)
downloadstrace-9fd4f96d2a2527ac7ca90c156bfc11ce10118684.tar.gz
strace-9fd4f96d2a2527ac7ca90c156bfc11ce10118684.tar.bz2
strace-9fd4f96d2a2527ac7ca90c156bfc11ce10118684.tar.xz
Optimize code if we have only one personality
On i386: text data bss dec hex filename 238025 672 18980 257677 3ee8d strace.before 237389 704 18944 257037 3ec0d strace * defs.h: Define PERSONALITY0_WORDSIZE as sizeof(long) if not defined. Introduce new define, current_wordsize as (personality_wordsize[current_personality]). Make set_personality() no-op, current_personality constant zero, current_wordsize as PERSONALITY0_WORDSIZE if we have only one personality. * count.c (call_summary): Use current_wordsize instead of personality_wordsize[current_personality]. * desc.c (printflock): Likewise. * file.c (sys_utime): Likewise. * io.c (tprint_iov): Likewise. * process.c (printargv): Likewise. * resource.c (decode_rlimit): Likewise. * signal.c (sys_kill): Likewise. (sys_rt_sigaction): Likewise. * time.c (sprinttv): Likewise. (sprint_timespec): Likewise. (printitv_bitness): Likewise. (tprint_timex): Likewise. (printsigevent): Likewise. * util.c (dumpiov): Likewise. (umoven): Likewise. (umovestr): Likewise. * syscall.c: Initialize sysent to sysent0 etc. Make current_personality, personality_wordsize[], set_personality() conditional on SUPPORTED_PERSONALITIES > 1. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'signal.c')
-rw-r--r--signal.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/signal.c b/signal.c
index 11b133d..ab7ae56 100644
--- a/signal.c
+++ b/signal.c
@@ -1226,7 +1226,7 @@ sys_kill(struct tcb *tcp)
long pid = tcp->u_arg[0];
#if SUPPORTED_PERSONALITIES > 1
/* Sign-extend a 32-bit value when that's what it is. */
- if (personality_wordsize[current_personality] < sizeof pid)
+ if (current_wordsize < sizeof pid)
pid = (long) (int) pid;
#endif
tprintf("%ld, %s", pid, signame(tcp->u_arg[1]));
@@ -1335,8 +1335,7 @@ sys_rt_sigaction(struct tcb *tcp)
}
#if SUPPORTED_PERSONALITIES > 1
#if SIZEOF_LONG > 4
- if (personality_wordsize[current_personality] != sizeof(sa.sa_flags)
- && personality_wordsize[current_personality] == 4) {
+ if (current_wordsize != sizeof(sa.sa_flags) && current_wordsize == 4) {
struct new_sigaction32 sa32;
r = umove(tcp, addr, &sa32);
if (r >= 0) {