From 515c97a08bcfa832e1b3a6c8574aa222ada1a01d Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Sat, 4 May 2019 23:15:52 +0000 Subject: [PATCH] time.c: introduce do_timer_gettime and do_timer_settime 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 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/time.c b/time.c index 21b839e1..c6123197 100644 --- 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) -- 2.40.0