]> granicus.if.org Git - strace/commitdiff
time.c: introduce do_timerfd_gettime and do_timerfd_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 timerfd_gettime64
and timerfd_settime64 syscalls.

* time.c (do_timerfd_settime, do_timerfd_gettime): New functions.
((SYS_FUNC(timerfd_settime)): Turn into a thin wrapper around
do_timerfd_settime.
((SYS_FUNC(timerfd_gettime)): Turn into a thin wrapper around
do_timerfd_gettime.

time.c

diff --git a/time.c b/time.c
index c61231971f90739c884609cd643a40faeb295b10..982c46758978a58295808b39b5849519a1aad41d 100644 (file)
--- a/time.c
+++ b/time.c
@@ -347,28 +347,40 @@ SYS_FUNC(timerfd_create)
        return RVAL_DECODED | RVAL_FD;
 }
 
-SYS_FUNC(timerfd_settime)
+static int
+do_timerfd_settime(struct tcb *const tcp, const print_obj_by_addr_fn print_its)
 {
        if (entering(tcp)) {
                printfd(tcp, tcp->u_arg[0]);
                tprints(", ");
                printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
                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(timerfd_gettime)
+SYS_FUNC(timerfd_settime)
+{
+       return do_timerfd_settime(tcp, print_itimerspec);
+}
+
+static int
+do_timerfd_gettime(struct tcb *const tcp, const print_obj_by_addr_fn print_its)
 {
        if (entering(tcp)) {
                printfd(tcp, tcp->u_arg[0]);
                tprints(", ");
        } else {
-               print_itimerspec(tcp, tcp->u_arg[1]);
+               print_its(tcp, tcp->u_arg[1]);
        }
        return 0;
 }
+
+SYS_FUNC(timerfd_gettime)
+{
+       return do_timerfd_gettime(tcp, print_itimerspec);
+}