summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2003-03-30 23:52:28 +0000
committerRoland McGrath <roland@redhat.com>2003-03-30 23:52:28 +0000
commit1e35679bbb8c840bd0b107c68cb187feeb3e3282 (patch)
tree68dbe0bd9cc111616f56ef8f30518d99542ebf76 /time.c
parente9a188d51e041830e5e03e4ea92dbcc6121329f7 (diff)
downloadstrace-1e35679bbb8c840bd0b107c68cb187feeb3e3282.tar.gz
strace-1e35679bbb8c840bd0b107c68cb187feeb3e3282.tar.bz2
strace-1e35679bbb8c840bd0b107c68cb187feeb3e3282.tar.xz
2003-03-30 Roland McGrath <roland@redhat.com>
* 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>.
Diffstat (limited to 'time.c')
-rw-r--r--time.c139
1 files changed, 139 insertions, 0 deletions
diff --git a/time.c b/time.c
index c9cbc8e..12d00f2 100644
--- 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 */