]> granicus.if.org Git - strace/blobdiff - fcntl.c
Print struct iovec as a regular structure
[strace] / fcntl.c
diff --git a/fcntl.c b/fcntl.c
index e2a76f980870a6f9db5f9525edd43ea5b1ce556b..bfe8b1458d20f3514f22c8a1ec395ebd001141b2 100644 (file)
--- a/fcntl.c
+++ b/fcntl.c
@@ -43,9 +43,9 @@ static void
 print_struct_flock64(const struct_kernel_flock64 *fl, const int getlk)
 {
        tprints("{l_type=");
-       printxval(lockfcmds, fl->l_type, "F_???");
+       printxval(lockfcmds, (unsigned short) fl->l_type, "F_???");
        tprints(", l_whence=");
-       printxval(whence_codes, fl->l_whence, "SEEK_???");
+       printxval(whence_codes, (unsigned short) fl->l_whence, "SEEK_???");
        tprintf(", l_start=%lld, l_len=%lld",
                (long long) fl->l_start, (long long) fl->l_len);
        if (getlk)
@@ -87,7 +87,9 @@ print_f_owner_ex(struct tcb *tcp, const long addr)
 static int
 print_fcntl(struct tcb *tcp)
 {
-       switch (tcp->u_arg[1]) {
+       const unsigned int cmd = tcp->u_arg[1];
+
+       switch (cmd) {
        case F_SETFD:
                tprints(", ");
                printflags(fdflags, tcp->u_arg[2], "FD_???");
@@ -120,15 +122,15 @@ print_fcntl(struct tcb *tcp)
                break;
        case F_NOTIFY:
                tprints(", ");
-               printflags(notifyflags, tcp->u_arg[2], "DN_???");
+               printflags_long(notifyflags, tcp->u_arg[2], "DN_???");
                break;
        case F_SETLEASE:
                tprints(", ");
-               printxval(lockfcmds, tcp->u_arg[2], "F_???");
+               printxval_long(lockfcmds, tcp->u_arg[2], "F_???");
                break;
        case F_ADD_SEALS:
                tprints(", ");
-               printflags(f_seals, tcp->u_arg[2], "F_SEAL_???");
+               printflags_long(f_seals, tcp->u_arg[2], "F_SEAL_???");
                break;
        case F_SETSIG:
                tprints(", ");
@@ -194,8 +196,8 @@ SYS_FUNC(fcntl)
        if (entering(tcp)) {
                printfd(tcp, tcp->u_arg[0]);
                tprints(", ");
-               const char *str =
-                       xlookup(fcntlcmds, (unsigned long) tcp->u_arg[1]);
+               const unsigned int cmd = tcp->u_arg[1];
+               const char *str = xlookup(fcntlcmds, cmd);
                if (str) {
                        tprints(str);
                } else {
@@ -204,7 +206,7 @@ SYS_FUNC(fcntl)
                         * constants, but we would like to show them
                         * for better debugging experience.
                         */
-                       printxval(fcntl64cmds, tcp->u_arg[1], "F_???");
+                       printxval(fcntl64cmds, cmd, "F_???");
                }
        }
        return print_fcntl(tcp);
@@ -212,18 +214,18 @@ SYS_FUNC(fcntl)
 
 SYS_FUNC(fcntl64)
 {
+       const unsigned int cmd = tcp->u_arg[1];
        if (entering(tcp)) {
                printfd(tcp, tcp->u_arg[0]);
                tprints(", ");
-               const char *str =
-                       xlookup(fcntl64cmds, (unsigned long) tcp->u_arg[1]);
+               const char *str = xlookup(fcntl64cmds, cmd);
                if (str) {
                        tprints(str);
                } else {
-                       printxval(fcntlcmds, tcp->u_arg[1], "F_???");
+                       printxval(fcntlcmds, cmd, "F_???");
                }
        }
-       switch (tcp->u_arg[1]) {
+       switch (cmd) {
                case F_SETLK64:
                case F_SETLKW64:
                        tprints(", ");