]> granicus.if.org Git - strace/commitdiff
time.c: introduce do_timer_gettime and do_timer_settime
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 4 May 2019 23:15:52 +0000 (23:15 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 4 May 2019 23:15:52 +0000 (23:15 +0000)
These are going to be used to implement parsers of timer_gettime64 and
timer_settime64 syscalls.

* time.c (do_timer_settime, do_timer_gettime): New functions.
((SYS_FUNC(timer_settime)): Turn into a thin wrapper around
do_timer_settime.
((SYS_FUNC(timer_gettime)): Turn into a thin wrapper around
do_timer_gettime.

time.c

diff --git a/time.c b/time.c
index 21b839e17c9a15c0e50fe122971b5dbc01694a94..c61231971f90739c884609cd643a40faeb295b10 100644 (file)
--- a/time.c
+++ b/time.c
@@ -300,30 +300,42 @@ SYS_FUNC(timer_create)
        return 0;
 }
 
-SYS_FUNC(timer_settime)
+static int
+do_timer_settime(struct tcb *const tcp, const print_obj_by_addr_fn print_its)
 {
        if (entering(tcp)) {
                tprintf("%d, ", (int) tcp->u_arg[0]);
                printflags(clockflags, tcp->u_arg[1], "TIMER_???");
                tprints(", ");
-               print_itimerspec(tcp, tcp->u_arg[2]);
+               print_its(tcp, tcp->u_arg[2]);
                tprints(", ");
        } else {
-               print_itimerspec(tcp, tcp->u_arg[3]);
+               print_its(tcp, tcp->u_arg[3]);
        }
        return 0;
 }
 
-SYS_FUNC(timer_gettime)
+SYS_FUNC(timer_settime)
+{
+       return do_timer_settime(tcp, print_itimerspec);
+}
+
+static int
+do_timer_gettime(struct tcb *const tcp, const print_obj_by_addr_fn print_its)
 {
        if (entering(tcp)) {
                tprintf("%d, ", (int) tcp->u_arg[0]);
        } else {
-               print_itimerspec(tcp, tcp->u_arg[1]);
+               print_its(tcp, tcp->u_arg[1]);
        }
        return 0;
 }
 
+SYS_FUNC(timer_gettime)
+{
+       return do_timer_gettime(tcp, print_itimerspec);
+}
+
 #include "xlat/timerfdflags.h"
 
 SYS_FUNC(timerfd_create)