Remove redundant checks in syscall entry/exit, rename badly named function
* syscall.c (syscall_enter): Rename to get_syscall_args.
Document its return values.
(trace_syscall_entering): Don't check get_syscall_args() return
value for 0, it never returns that.
(syscall_fixup_on_sysexit): Make it return void.
(trace_syscall_exiting): Fix up syscall_fixup_on_sysexit()
call site accordingly.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/syscall.c b/syscall.c
index 134be81..8d74f68 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1247,8 +1247,9 @@
#endif
}
+/* Return -1 on error or 1 on success (never 0!) */
static int
-syscall_enter(struct tcb *tcp)
+get_syscall_args(struct tcb *tcp)
{
int i, nargs;
@@ -1463,9 +1464,7 @@
if (res == 0)
return res;
if (res == 1)
- res = syscall_enter(tcp);
- if (res == 0)
- return res;
+ res = get_syscall_args(tcp);
if (res != 1) {
printleader(tcp);
@@ -1639,14 +1638,8 @@
return 1;
}
-/* Called at each syscall exit.
- * Returns:
- * 0: "ignore this ptrace stop", bail out of trace_syscall() silently.
- * 1: ok, continue in trace_syscall().
- * other: error, trace_syscall() should print error indicator
- * ("????" etc) and bail out.
- */
-static int
+/* Called at each syscall exit */
+static void
syscall_fixup_on_sysexit(struct tcb *tcp)
{
#if defined(S390) || defined(S390X)
@@ -1662,7 +1655,6 @@
gpr2 = 0;
}
#endif
- return 1;
}
/*
@@ -1912,12 +1904,10 @@
res = get_syscall_result(tcp);
if (res == 0)
return res;
- if (res == 1)
- res = syscall_fixup_on_sysexit(tcp);
- if (res == 0)
- return res;
- if (res == 1)
+ if (res == 1) {
+ syscall_fixup_on_sysexit(tcp); /* never fails */
res = get_error(tcp);
+ }
if (res == 0)
return res;
if (res == 1)