]> granicus.if.org Git - strace/commitdiff
2004-08-30 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Tue, 31 Aug 2004 06:52:45 +0000 (06:52 +0000)
committerRoland McGrath <roland@redhat.com>
Tue, 31 Aug 2004 06:52:45 +0000 (06:52 +0000)
* time.c (clocknames): New variable, symbolic names for clock_t.
(sys_clock_settime, sys_clock_gettime, sys_clock_nanosleep): Use it.
From Ulrich Drepper <drepper@redhat.com>.
Fixes RH#129378.

time.c

diff --git a/time.c b/time.c
index eb02f4c64ae6d4ce99a74ac784c1c120b1d430a3..28c05bd28243fd652d57e185b6a33dece53fc441 100644 (file)
--- a/time.c
+++ b/time.c
@@ -364,12 +364,19 @@ static struct xlat clockflags[] = {
   { 0,             NULL }
 };
 
+static struct xlat clocknames[] = {
+  { CLOCK_REALTIME, "CLOCK_REALTIME" },
+  { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" },
+  { 0,             NULL }
+};
+
 int
 sys_clock_settime(tcp)
 struct tcb *tcp;
 {
        if (entering(tcp)) {
-               tprintf("%#lx, ", tcp->u_arg[0]);
+               printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
+               tprintf(", ");
                printtv(tcp, tcp->u_arg[1]);
        }
        return 0;
@@ -380,7 +387,8 @@ sys_clock_gettime(tcp)
 struct tcb *tcp;
 {
        if (entering(tcp)) {
-               tprintf("%#lx, ", tcp->u_arg[0]);
+               printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
+               tprintf(", ");
        } else {
                if (syserror(tcp))
                        tprintf("%#lx", tcp->u_arg[1]);
@@ -395,7 +403,8 @@ sys_clock_nanosleep(tcp)
 struct tcb *tcp;
 {
        if (entering(tcp)) {
-               tprintf("%#lx, ", tcp->u_arg[0]);
+               printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
+               tprintf(", ");
                printflags(clockflags, tcp->u_arg[1]);
                tprintf(", ");
                printtv(tcp, tcp->u_arg[2]);