]> granicus.if.org Git - strace/commitdiff
2005-02-01 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Wed, 2 Feb 2005 04:16:56 +0000 (04:16 +0000)
committerRoland McGrath <roland@redhat.com>
Wed, 2 Feb 2005 04:16:56 +0000 (04:16 +0000)
* process.c [LINUX] [X86_64] (sys_arch_prctl): New function.
* linux/syscall.h: Declare it.
* linux/x86_64/syscallent.h: Use it.
Part of RH#142667.
* process.c (sys_sched_setscheduler): Use %#lx format for bad pointer.
(sys_sched_getparam, sys_sched_setparam): Likewise.
Part of RH#142667.

process.c

index 0a7f4868aff74eda155e4a77dd04cb07617785b2..d28fa4767cc7f5b2ae236aedd83eefd8f2d8d5f9 100644 (file)
--- a/process.c
+++ b/process.c
@@ -3096,7 +3096,7 @@ struct tcb *tcp;
        tprintf("%d, ", (int) tcp->u_arg[0]);
        printxval(schedulers, tcp->u_arg[1], "SCHED_???");
        if (umove(tcp, tcp->u_arg[2], &p) < 0)
-           tprintf(", %lx", tcp->u_arg[2]);
+           tprintf(", %#lx", tcp->u_arg[2]);
        else
            tprintf(", { %d }", p.__sched_priority);
     }
@@ -3112,7 +3112,7 @@ struct tcb *tcp;
     } else {
        struct sched_param p;
        if (umove(tcp, tcp->u_arg[1], &p) < 0)
-           tprintf("%lx", tcp->u_arg[1]);
+           tprintf("%#lx", tcp->u_arg[1]);
        else
            tprintf("{ %d }", p.__sched_priority);
     }
@@ -3126,7 +3126,7 @@ struct tcb *tcp;
     if (entering(tcp)) {
        struct sched_param p;
        if (umove(tcp, tcp->u_arg[1], &p) < 0)
-           tprintf("%d, %lx", (int) tcp->u_arg[0], tcp->u_arg[1]);
+           tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]);
        else
            tprintf("%d, { %d }", (int) tcp->u_arg[0], p.__sched_priority);
     }
@@ -3142,4 +3142,39 @@ struct tcb *tcp;
     }
     return 0;
 }
+
+#ifdef X86_64
+#include <asm/prctl.h>
+
+static const struct xlat archvals[] = {
+       { ARCH_SET_GS,          "ARCH_SET_GS"           },
+       { ARCH_SET_FS,          "ARCH_SET_FS"           },
+       { ARCH_GET_FS,          "ARCH_GET_FS"           },
+       { ARCH_GET_GS,          "ARCH_GET_GS"           },
+       { 0,                    NULL                    },
+};
+
+int
+sys_arch_prctl(tcp)
+struct tcb *tcp;
+{
+    if (entering(tcp)) {
+       printxval(archvals, tcp->u_arg[0], "ARCH_???");
+       if (tcp->u_arg[0] == ARCH_SET_GS
+           || tcp->u_arg[0] == ARCH_SET_FS)
+           tprintf(", %#lx", tcp->u_arg[1]);
+    } else {
+       if (tcp->u_arg[0] == ARCH_GET_GS
+           || tcp->u_arg[0] == ARCH_GET_FS) {
+           long int v;
+           if (!syserror(tcp) && umove(tcp, tcp->u_arg[1], &v) != -1)
+               tprintf(", [%#lx]", v);
+           else
+               tprintf(", %#lx", tcp->u_arg[1]);
+       }
+    }
+    return 0;
+}
+#endif
+
 #endif