]> granicus.if.org Git - strace/commitdiff
struct tcb: change the type of u_error field from int to unsigned long
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 3 Oct 2016 11:48:55 +0000 (11:48 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 3 Oct 2016 11:48:55 +0000 (11:48 +0000)
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.

defs.h
syscall.c

diff --git a/defs.h b/defs.h
index d447eb1e39e1f7b42890aa413d05dab646106628..b2d7da97109663be9fdf554859c626e5c52e19b9 100644 (file)
--- 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
index a43ff43f278a6d5df9d3e1483680cddba546fb7a..5c9b034dc850a1ca8614f2c90a39e6c949380ae5 100644 (file)
--- 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)