From: Denys Vlasenko Date: Sun, 21 Aug 2011 15:47:40 +0000 (+0200) Subject: count_syscall() always returns 0, optimize it X-Git-Tag: v4.7~307 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c95a88f124895042345473fad58daa30da9e1565;p=strace count_syscall() always returns 0, optimize it * defs.h (count_syscall): Change return type from int to void. * count.c (count_syscall): Change return type from int to void. * syscall.c (trace_syscall_exiting): Change code around call to count_syscall accordingly. Signed-off-by: Denys Vlasenko --- diff --git a/count.c b/count.c index 625ed4e5..86b19531 100644 --- a/count.c +++ b/count.c @@ -47,11 +47,11 @@ static struct call_counts *countv[SUPPORTED_PERSONALITIES]; static struct timeval shortest = { 1000000, 0 }; -int +void count_syscall(struct tcb *tcp, struct timeval *tv) { if (tcp->scno < 0 || tcp->scno >= nsyscalls) - return 0; + return; if (!counts) { counts = calloc(nsyscalls, sizeof(*counts)); @@ -95,8 +95,6 @@ count_syscall(struct tcb *tcp, struct timeval *tv) if (tv_cmp(tv, &shortest) < 0) shortest = *tv; tv_add(&counts[tcp->scno].time, &counts[tcp->scno].time, tv); - - return 0; } static int diff --git a/defs.h b/defs.h index a06acde6..c4ea5fab 100644 --- a/defs.h +++ b/defs.h @@ -571,7 +571,7 @@ extern long do_ptrace(int request, struct tcb *tcp, void *addr, void *data); extern int ptrace_restart(int request, struct tcb *tcp, int sig); extern int force_result(struct tcb *, int, long); extern int trace_syscall(struct tcb *); -extern int count_syscall(struct tcb *, struct timeval *); +extern void count_syscall(struct tcb *, struct timeval *); extern void printxval(const struct xlat *, int, const char *); extern int printargs(struct tcb *); extern void addflags(const struct xlat *, int); diff --git a/syscall.c b/syscall.c index 76ef39c1..200d8d64 100644 --- a/syscall.c +++ b/syscall.c @@ -2419,10 +2419,10 @@ trace_syscall_exiting(struct tcb *tcp) if (cflag) { struct timeval t = tv; - int rc = count_syscall(tcp, &t); + count_syscall(tcp, &t); if (cflag == CFLAG_ONLY_STATS) { tcp->flags &= ~TCB_INSYSCALL; - return rc; + return 0; } }