2008-04-19 Dmitry V. Levin <ldv@altlinux.org>

* desc.c (sys_fcntl): Do not initialize auxstr for failed syscall.
	* process.c (sys_fork, sys_rfork) [USE_PROCFS]: Likewise.
	* signal.c (sys_signal): Likewise.
	* stream.c (internal_stream_ioctl): Likewise.
	* time.c (sys_adjtimex): Likewise.
	* syscall.c (trace_syscall): If RVAL_STR is set, then
	print auxstr for failed syscall as well.
This commit is contained in:
Дмитрий Левин 2008-09-03 01:22:18 +00:00
parent 2e55ff4562
commit 21a7534745
7 changed files with 20 additions and 5 deletions

View File

@ -1,5 +1,13 @@
2008-04-19 Dmitry V. Levin <ldv@altlinux.org>
* desc.c (sys_fcntl): Do not initialize auxstr for failed syscall.
* process.c (sys_fork, sys_rfork) [USE_PROCFS]: Likewise.
* signal.c (sys_signal): Likewise.
* stream.c (internal_stream_ioctl): Likewise.
* time.c (sys_adjtimex): Likewise.
* syscall.c (trace_syscall): If RVAL_STR is set, then
print auxstr for failed syscall as well.
* syscall.c (is_restart_error): New function.
* defs.h (is_restart_error): Declare it.

4
desc.c
View File

@ -332,12 +332,14 @@ sys_fcntl(struct tcb *tcp)
case F_SETOWN: case F_GETOWN:
break;
case F_GETFD:
if (tcp->u_rval == 0)
if (syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr =
sprintflags("flags ", fdflags, tcp->u_rval);
return RVAL_HEX|RVAL_STR;
case F_GETFL:
if (syserror(tcp))
return 0;
tcp->auxstr = sprint_open_modes(tcp->u_rval);
return RVAL_HEX|RVAL_STR;
case F_GETLK:

View File

@ -498,7 +498,7 @@ int
sys_fork(tcp)
struct tcb *tcp;
{
if (exiting(tcp)) {
if (exiting(tcp) && !syserror(tcp)) {
if (getrval2(tcp)) {
tcp->auxstr = "child process";
return RVAL_UDECIMAL | RVAL_STR;
@ -516,7 +516,7 @@ struct tcb *tcp;
if (entering(tcp)) {
tprintf ("%ld", tcp->u_arg[0]);
}
else {
else if (!syserror(tcp)) {
if (getrval2(tcp)) {
tcp->auxstr = "child process";
return RVAL_UDECIMAL | RVAL_STR;

View File

@ -1199,7 +1199,7 @@ struct tcb *tcp;
}
return 0;
}
else {
else if (!syserror(tcp)) {
switch (tcp->u_rval) {
case (long) SIG_ERR:
tcp->auxstr = "SIG_ERR"; break;
@ -1212,6 +1212,7 @@ struct tcb *tcp;
}
return RVAL_HEX | RVAL_STR;
}
return 0;
}
#ifdef SVR4

View File

@ -1177,7 +1177,7 @@ int arg;
}
if (exiting(tcp)) {
tprintf("}");
if (timod && tcp->u_rval) {
if (timod && tcp->u_rval && !syserror(tcp)) {
tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
return RVAL_STR + 1;
}

View File

@ -2369,6 +2369,8 @@ trace_syscall(struct tcb *tcp)
strerror(u_error));
break;
}
if ((sys_res & RVAL_STR) && tcp->auxstr)
tprintf(" (%s)", tcp->auxstr);
}
else {
if (sys_res & RVAL_NONE)

2
time.c
View File

@ -674,6 +674,8 @@ sys_adjtimex(struct tcb *tcp)
tprintf("%#lx", tcp->u_arg[0]);
else if (tprint_timex(tcp, tcp->u_arg[0]) < 0)
tprintf("{...}");
if (syserror(tcp))
return 0;
tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
if (tcp->auxstr)
return RVAL_STR;