]> granicus.if.org Git - strace/blobdiff - prctl.c
tests: check decoding of accept4 syscall
[strace] / prctl.c
diff --git a/prctl.c b/prctl.c
index a0b4e96cd8f4cd784336697778535124bcf5ddea..cd51d4c0c24302cca3d26be6653e7bf14bc8bf07 100644 (file)
--- a/prctl.c
+++ b/prctl.c
@@ -73,12 +73,13 @@ print_prctl_args(struct tcb *tcp, const unsigned int first)
 
 SYS_FUNC(prctl)
 {
+       const unsigned int option = tcp->u_arg[0];
        unsigned int i;
 
        if (entering(tcp))
-               printxval(prctl_options, tcp->u_arg[0], "PR_???");
+               printxval(prctl_options, option, "PR_???");
 
-       switch (tcp->u_arg[0]) {
+       switch (option) {
        case PR_GET_DUMPABLE:
        case PR_GET_KEEPCAPS:
        case PR_GET_SECCOMP:
@@ -171,18 +172,19 @@ SYS_FUNC(prctl)
        case PR_CAPBSET_DROP:
        case PR_CAPBSET_READ:
                tprints(", ");
-               printxval(cap, tcp->u_arg[1], "CAP_???");
+               printxval_long(cap, tcp->u_arg[1], "CAP_???");
                return RVAL_DECODED;
 
        case PR_CAP_AMBIENT:
                tprints(", ");
-               printxval(pr_cap_ambient, tcp->u_arg[1], "PR_CAP_AMBIENT_???");
+               printxval_long(pr_cap_ambient, tcp->u_arg[1],
+                              "PR_CAP_AMBIENT_???");
                switch (tcp->u_arg[1]) {
                case PR_CAP_AMBIENT_RAISE:
                case PR_CAP_AMBIENT_LOWER:
                case PR_CAP_AMBIENT_IS_SET:
                        tprints(", ");
-                       printxval(cap, tcp->u_arg[2], "CAP_???");
+                       printxval_long(cap, tcp->u_arg[2], "CAP_???");
                        print_prctl_args(tcp, 3);
                        break;
                default:
@@ -193,10 +195,10 @@ SYS_FUNC(prctl)
 
        case PR_MCE_KILL:
                tprints(", ");
-               printxval(pr_mce_kill, tcp->u_arg[1], "PR_MCE_KILL_???");
+               printxval_long(pr_mce_kill, tcp->u_arg[1], "PR_MCE_KILL_???");
                tprints(", ");
                if (PR_MCE_KILL_SET == tcp->u_arg[1])
-                       printxval(pr_mce_kill_policy, tcp->u_arg[2],
+                       printxval_long(pr_mce_kill_policy, tcp->u_arg[2],
                                   "PR_MCE_KILL_???");
                else
                        tprintf("%#lx", tcp->u_arg[2]);
@@ -249,7 +251,7 @@ SYS_FUNC(prctl)
 
        case PR_SET_SECCOMP:
                tprints(", ");
-               printxval(seccomp_mode, tcp->u_arg[1],
+               printxval_long(seccomp_mode, tcp->u_arg[1],
                          "SECCOMP_MODE_???");
                if (SECCOMP_MODE_STRICT == tcp->u_arg[1])
                        return RVAL_DECODED;
@@ -263,7 +265,7 @@ SYS_FUNC(prctl)
 
        case PR_SET_SECUREBITS:
                tprints(", ");
-               printflags(secbits, tcp->u_arg[1], "SECBIT_???");
+               printflags_long(secbits, tcp->u_arg[1], "SECBIT_???");
                return RVAL_DECODED;
 
        case PR_SET_TIMERSLACK:
@@ -314,10 +316,12 @@ SYS_FUNC(prctl)
 
 SYS_FUNC(arch_prctl)
 {
+       const unsigned int option = tcp->u_arg[0];
+
        if (entering(tcp))
-               printxval(archvals, tcp->u_arg[0], "ARCH_???");
+               printxval(archvals, option, "ARCH_???");
 
-       switch (tcp->u_arg[0]) {
+       switch (option) {
        case ARCH_GET_GS:
        case ARCH_GET_FS:
                if (entering(tcp))