#if SUPPORTED_PERSONALITIES > 1
unsigned int currpers; /* Personality at the time of scno update */
#endif
+ int sys_func_rval; /* Syscall entry parser's return value */
int curcol; /* Output column for this process */
FILE *outf; /* Output file for this process */
const char *auxstr; /* Auxiliary info from syscall (see RVAL_STR) */
#define RVAL_STR 020 /* Print `auxstr' field after return val */
#define RVAL_NONE 040 /* Print nothing */
+#define RVAL_DECODED 0100 /* syscall decoding finished */
+
#define TRACE_FILE 001 /* Trace file-related syscalls. */
#define TRACE_IPC 002 /* Trace IPC-related syscalls. */
#define TRACE_NETWORK 004 /* Trace network-related syscalls. */
SYS_FUNC(ioctl)
{
const struct_ioctlent *iop;
+ int ret;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
ioctl_print_code(tcp->u_arg[1]);
}
}
- ioctl_decode(tcp);
+ ret = ioctl_decode(tcp);
+ } else {
+ ret = ioctl_decode(tcp) | RVAL_DECODED;
}
- else {
- int ret = ioctl_decode(tcp);
- if (!ret)
- tprintf(", %#lx", tcp->u_arg[2]);
+
+ if (ret & RVAL_DECODED) {
+ ret &= ~RVAL_DECODED;
+ if (ret)
+ --ret;
else
- return ret - 1;
+ tprintf(", %#lx", tcp->u_arg[2]);
+ ret |= RVAL_DECODED;
+ } else {
+ if (ret)
+ --ret;
}
- return 0;
+
+ return ret;
}
|| (tracing_paths && !pathtrace_match(tcp))
) {
tcp->flags |= TCB_INSYSCALL | TCB_FILTERED;
+ tcp->sys_func_rval = 0;
return 0;
}
fflush(tcp->outf);
ret:
tcp->flags |= TCB_INSYSCALL;
+ tcp->sys_func_rval = res;
/* Measure the entrance time as late as possible to avoid errors. */
if (Tflag || cflag)
gettimeofday(&tcp->etime, NULL);
tprints("= ? <unavailable>\n");
line_ended();
tcp->flags &= ~TCB_INSYSCALL;
+ tcp->sys_func_rval = 0;
return res;
}
tcp->s_prev_ent = tcp->s_ent;
*/
if (not_failing_only && tcp->u_error)
goto ret; /* ignore failed syscalls */
- sys_res = tcp->s_ent->sys_func(tcp);
+ if (tcp->sys_func_rval & RVAL_DECODED)
+ sys_res = tcp->sys_func_rval;
+ else
+ sys_res = tcp->s_ent->sys_func(tcp);
}
tprints(") ");
ret:
tcp->flags &= ~TCB_INSYSCALL;
+ tcp->sys_func_rval = 0;
return 0;
}