]> granicus.if.org Git - strace/commitdiff
2003-03-30 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Sun, 30 Mar 2003 23:52:28 +0000 (23:52 +0000)
committerRoland McGrath <roland@redhat.com>
Sun, 30 Mar 2003 23:52:28 +0000 (23:52 +0000)
* time.c [LINUX]: Handle new Linux 2.5 clock/timer syscalls.
* linux/syscall.h, linux/syscallent.h, linux/dummy.h: Likewise.
From Ulrich Drepper <drepper@redhat.com>.

linux/dummy.h
linux/syscall.h
time.c

index 7cc6985fc66d4d6edf38c1100d302364ea00b609..ba331627598c15125706d5e2be2ce7a1122e9522 100644 (file)
@@ -68,6 +68,7 @@
 #define sys_fdatasync          sys_close
 #define sys_mlock              sys_munmap
 #define sys_munlock            sys_munmap
+#define sys_clock_getres       sys_clock_gettime
 
 /* printargs does the right thing */
 #define        sys_setup               printargs
@@ -85,6 +86,8 @@
 #define        sys_idle                printargs
 #define        sys_getpgid             printargs
 #define sys_munlockall         printargs
+#define sys_timer_getoverrun   printargs
+#define sys_timer_delete       printargs
 
 /* subcall entry points */
 #define        sys_socketcall          printargs
index f9266ed9298508dc47f96a76d73206282eeea69b..df2310d9911e1ea50706e59e5e0bdcacd34e8b8d 100644 (file)
@@ -89,6 +89,9 @@ int sys_setxattr(), sys_fsetxattr(), sys_getxattr(), sys_fgetxattr();
 int sys_listxattr(), sys_flistxattr(), sys_removexattr(), sys_fremovexattr();
 int sys_sched_setaffinity(), sys_sched_getaffinity(), sys_futex();
 int sys_set_thread_area(), sys_get_thread_area(), sys_remap_file_pages();
+int sys_timer_create(), sys_timer_delete(), sys_timer_getoverrun();
+int sys_timer_gettime(), sys_timer_settime(), sys_clock_settime();
+int sys_clock_gettime(), sys_clock_getres(), sys_clock_nanosleep();
 
 
 /* sys_socketcall subcalls */
diff --git a/time.c b/time.c
index c9cbc8ee3cdfee356cb30114f45b5c0b51a995cc..12d00f24bccc1765eb92e33101d18abdc30b2042 100644 (file)
--- a/time.c
+++ b/time.c
@@ -358,5 +358,144 @@ struct tcb *tcp;
        }
        return 0;
 }
+
+static struct xlat clockflags[] = {
+  { TIMER_ABSTIME, "TIMER_ABSTIME" },
+  { 0,             NULL }
+};
+
+int
+sys_clock_settime(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               tprintf("%#lx, ", tcp->u_arg[0]);
+               printtv(tcp, tcp->u_arg[1]);
+       }
+       return 0;
+}
+
+int
+sys_clock_gettime(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               tprintf("%#lx, ", tcp->u_arg[0]);
+       } else {
+               if (syserror(tcp))
+                       tprintf("%#lx", tcp->u_arg[1]);
+               else
+                       printtv(tcp, tcp->u_arg[1]);
+       }
+       return 0;
+}
+
+int
+sys_clock_nanosleep(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               tprintf("%#lx, ", tcp->u_arg[0]);
+               printflags(clockflags, tcp->u_arg[1]);
+               tprintf(", ");
+               printtv(tcp, tcp->u_arg[2]);
+               tprintf(", ");
+       } else {
+               if (syserror(tcp))
+                       tprintf("%#lx", tcp->u_arg[3]);
+               else
+                       printtv(tcp, tcp->u_arg[3]);
+       }
+       return 0;
+}
+
+#ifndef SIGEV_THREAD_ID
+# define SIGEV_THREAD_ID 4
+#endif
+static struct xlat sigev_value[] = {
+       { SIGEV_SIGNAL+1, "SIGEV_SIGNAL" },
+       { SIGEV_NONE+1, "SIGEV_NONE" },
+       { SIGEV_THREAD+1, "SIGEV_THREAD" },
+       { SIGEV_THREAD_ID+1, "SIGEV_THREAD_ID" },
+       { 0, NULL }
+};
+
+void
+printsigevent(tcp, arg)
+struct tcb *tcp;
+long arg;
+{
+       struct sigevent sev;
+       if (umove (tcp, arg, &sev) < 0)
+               tprintf("{...}");
+       else {
+               tprintf("{%p, %u, ", sev.sigev_value.sival_ptr,
+                       sev.sigev_signo);
+               printxval(sigev_value, sev.sigev_notify+1, "SIGEV_???");
+               tprintf(", ");
+               if (sev.sigev_notify == SIGEV_THREAD_ID)
+                       /* _pad[0] is the _tid field which might not be
+                          present in the userlevel definition of the
+                          struct.  */
+                       tprintf("{%d}", sev._sigev_un._pad[0]);
+               else
+                       tprintf("{...}");
+               tprintf("}");
+       }
+}
+
+int
+sys_timer_create(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               tprintf("%#lx, ", tcp->u_arg[0]);
+               printsigevent(tcp, tcp->u_arg[1]);
+               tprintf(", ");
+       } else {
+               if (syserror(tcp))
+                       tprintf("%#lx", tcp->u_arg[2]);
+               else {
+                       void *p;
+                       umove(tcp, tcp->u_arg[2], &p);
+                       tprintf("{%p}", p);
+               }
+       }
+       return 0;
+}
+
+int
+sys_timer_settime(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               tprintf("%#lx, ", tcp->u_arg[0]);
+               printflags(clockflags, tcp->u_arg[1]);
+               tprintf(", ");
+               printitv(tcp, tcp->u_arg[2]);
+               tprintf(", ");
+       } else {
+               if (syserror(tcp))
+                       tprintf("%#lx", tcp->u_arg[3]);
+               else
+                       printitv(tcp, tcp->u_arg[3]);
+       }
+       return 0;
+}
+
+int
+sys_timer_gettime(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               tprintf("%#lx, ", tcp->u_arg[0]);
+       } else {
+               if (syserror(tcp))
+                       tprintf("%#lx", tcp->u_arg[1]);
+               else
+                       printitv(tcp, tcp->u_arg[1]);
+       }
+       return 0;
+}
 #endif /* LINUX */