diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-02-16 14:25:56 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-02-16 14:25:56 +0100 |
commit | c956ef085f5685b47bd7a66d0bff5abcb0a50484 (patch) | |
tree | 0c89f1af9b794d600fede0f0d14c4fe479011dc6 /syscall.c | |
parent | 5721cdbcdba76eef854a30e7e56e328eae976e44 (diff) | |
download | strace-c956ef085f5685b47bd7a66d0bff5abcb0a50484.tar.gz strace-c956ef085f5685b47bd7a66d0bff5abcb0a50484.tar.bz2 strace-c956ef085f5685b47bd7a66d0bff5abcb0a50484.tar.xz |
Simple optimization in get_error
* defs.h: Define SCNO_IN_RANGE(scno) macro.
* syscall.c (get_error): Change return type to void.
Use SCNO_IN_RANGE instead of SCNO_IS_VALID.
(trace_syscall_exiting): Stop checking get_error() return value.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'syscall.c')
-rw-r--r-- | syscall.c | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -2073,12 +2073,12 @@ is_negated_errno_x32(unsigned long long val) * -1: error, trace_syscall_exiting() should print error indicator * ("????" etc) and bail out. */ -static int +static void get_error(struct tcb *tcp) { int u_error = 0; int check_errno = 1; - if (SCNO_IS_VALID(tcp->scno) + if (SCNO_IN_RANGE(tcp->scno) && (sysent[tcp->scno].sys_flags & SYSCALL_NEVER_FAILS) ) { check_errno = 0; @@ -2304,7 +2304,6 @@ get_error(struct tcb *tcp) } #endif tcp->u_error = u_error; - return 1; } static void @@ -2358,14 +2357,11 @@ trace_syscall_exiting(struct tcb *tcp) res = (get_regs_error ? -1 : get_syscall_result(tcp)); if (res == 1) { syscall_fixup_on_sysexit(tcp); /* never fails */ - res = get_error(tcp); /* returns 1 or -1 */ - if (res == 1) { - if (need_fork_exec_workarounds) - syscall_fixup_for_fork_exec(tcp); - if (filtered(tcp)) { - goto ret; - } - } + get_error(tcp); /* never fails */ + if (need_fork_exec_workarounds) + syscall_fixup_for_fork_exec(tcp); + if (filtered(tcp)) + goto ret; } if (cflag) { |