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 <dvlasenk@redhat.com>
This commit is contained in:
parent
2ecba32d52
commit
c95a88f124
6
count.c
6
count.c
@ -47,11 +47,11 @@ static struct call_counts *countv[SUPPORTED_PERSONALITIES];
|
|||||||
|
|
||||||
static struct timeval shortest = { 1000000, 0 };
|
static struct timeval shortest = { 1000000, 0 };
|
||||||
|
|
||||||
int
|
void
|
||||||
count_syscall(struct tcb *tcp, struct timeval *tv)
|
count_syscall(struct tcb *tcp, struct timeval *tv)
|
||||||
{
|
{
|
||||||
if (tcp->scno < 0 || tcp->scno >= nsyscalls)
|
if (tcp->scno < 0 || tcp->scno >= nsyscalls)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
if (!counts) {
|
if (!counts) {
|
||||||
counts = calloc(nsyscalls, sizeof(*counts));
|
counts = calloc(nsyscalls, sizeof(*counts));
|
||||||
@ -95,8 +95,6 @@ count_syscall(struct tcb *tcp, struct timeval *tv)
|
|||||||
if (tv_cmp(tv, &shortest) < 0)
|
if (tv_cmp(tv, &shortest) < 0)
|
||||||
shortest = *tv;
|
shortest = *tv;
|
||||||
tv_add(&counts[tcp->scno].time, &counts[tcp->scno].time, tv);
|
tv_add(&counts[tcp->scno].time, &counts[tcp->scno].time, tv);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
2
defs.h
2
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 ptrace_restart(int request, struct tcb *tcp, int sig);
|
||||||
extern int force_result(struct tcb *, int, long);
|
extern int force_result(struct tcb *, int, long);
|
||||||
extern int trace_syscall(struct tcb *);
|
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 void printxval(const struct xlat *, int, const char *);
|
||||||
extern int printargs(struct tcb *);
|
extern int printargs(struct tcb *);
|
||||||
extern void addflags(const struct xlat *, int);
|
extern void addflags(const struct xlat *, int);
|
||||||
|
@ -2419,10 +2419,10 @@ trace_syscall_exiting(struct tcb *tcp)
|
|||||||
|
|
||||||
if (cflag) {
|
if (cflag) {
|
||||||
struct timeval t = tv;
|
struct timeval t = tv;
|
||||||
int rc = count_syscall(tcp, &t);
|
count_syscall(tcp, &t);
|
||||||
if (cflag == CFLAG_ONLY_STATS) {
|
if (cflag == CFLAG_ONLY_STATS) {
|
||||||
tcp->flags &= ~TCB_INSYSCALL;
|
tcp->flags &= ~TCB_INSYSCALL;
|
||||||
return rc;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user