From: Dmitry V. Levin Date: Mon, 3 Oct 2016 11:48:55 +0000 (+0000) Subject: struct tcb: change the type of u_error field from int to unsigned long X-Git-Tag: v4.14~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba63d8a16669737e75f761c9a316c7bf48741dc0;p=strace struct tcb: change the type of u_error field from int to unsigned long This is the type actually used for the error code on architectures that use a dedicated register. * defs.h (struct tcb): Change the type of u_error to unsigned long. * syscall.c (trace_syscall_exiting): Change the type of u_error variable to unsigned long, print it using %lu format, drop no longer needed explicit cast to unsigned long. (saved_u_error): Change type to unsigned long. --- diff --git a/defs.h b/defs.h index d447eb1e..b2d7da97 100644 --- a/defs.h +++ b/defs.h @@ -223,7 +223,7 @@ struct tcb { int flags; /* See below for TCB_ values */ int pid; /* If 0, this tcb is free */ int qual_flg; /* qual_flags[scno] or DEFAULT_QUAL_FLAGS + RAW */ - int u_error; /* Error code */ + unsigned long u_error; /* Error code */ long scno; /* System call number */ long u_arg[MAX_ARGS]; /* System call arguments */ #if HAVE_STRUCT_TCB_EXT_ARG diff --git a/syscall.c b/syscall.c index a43ff43f..5c9b034d 100644 --- a/syscall.c +++ b/syscall.c @@ -877,7 +877,7 @@ trace_syscall_exiting(struct tcb *tcp) int sys_res; struct timeval tv; int res; - long u_error; + unsigned long u_error; /* Measure the exit time as early as possible to avoid errors. */ if (Tflag || cflag) @@ -959,7 +959,7 @@ trace_syscall_exiting(struct tcb *tcp) u_error = tcp->u_error; if (tcp->qual_flg & QUAL_RAW) { if (u_error) - tprintf("= -1 (errno %ld)", u_error); + tprintf("= -1 (errno %lu)", u_error); else tprintf("= %#lx", tcp->u_rval); } @@ -1019,8 +1019,7 @@ trace_syscall_exiting(struct tcb *tcp) tprints("= ? ERESTART_RESTARTBLOCK (Interrupted by signal)"); break; default: - if ((unsigned long) u_error < nerrnos - && errnoent[u_error]) + if (u_error < nerrnos && errnoent[u_error]) tprintf("= -1 %s (%s)", errnoent[u_error], strerror(u_error)); else @@ -1137,7 +1136,7 @@ is_erestart(struct tcb *tcp) } } -static int saved_u_error; +static unsigned long saved_u_error; void temporarily_clear_syserror(struct tcb *tcp)