From: Dmitry V. Levin Date: Sat, 4 May 2019 23:15:52 +0000 (+0000) Subject: time.c: introduce do_timer_gettime and do_timer_settime X-Git-Tag: v5.1~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=515c97a08bcfa832e1b3a6c8574aa222ada1a01d;p=strace 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. --- 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)