From e55a41ae1a2db4c96c2ae0ab67b63ed0450aacfb 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_timerfd_gettime and do_timerfd_settime 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 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/time.c b/time.c index c6123197..982c4675 100644 --- 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); +} -- 2.40.0