From: Dmitry V. Levin Date: Sat, 4 May 2019 23:15:52 +0000 (+0000) Subject: do_adjtimex: parametrize print_timex X-Git-Tag: v5.1~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91e9f862d54f7c5115e1258a7b3b44d14d9df74d;p=strace do_adjtimex: parametrize print_timex This is going to be used to implement a parser of clock_adjtime64 syscall. * time.c (do_adjtimex): Add print_tx argument, invoke it instead of print_timex. (SYS_FUNC(adjtimex), SYS_FUNC(clock_adjtime)): Pass print_timex to do_adjtimex. --- diff --git a/time.c b/time.c index f3dc1a88..3ddc1e42 100644 --- a/time.c +++ b/time.c @@ -152,9 +152,10 @@ SYS_FUNC(osf_setitimer) #include "xlat/adjtimex_state.h" static int -do_adjtimex(struct tcb *const tcp, const kernel_ulong_t addr) +do_adjtimex(struct tcb *const tcp, const print_obj_by_addr_fn print_tx, + const kernel_ulong_t addr) { - if (print_timex(tcp, addr)) + if (print_tx(tcp, addr)) return 0; tcp->auxstr = xlat_idx(adjtimex_state, ARRAY_SIZE(adjtimex_state) - 1, (kernel_ulong_t) tcp->u_rval); @@ -164,7 +165,7 @@ do_adjtimex(struct tcb *const tcp, const kernel_ulong_t addr) SYS_FUNC(adjtimex) { if (exiting(tcp)) - return do_adjtimex(tcp, tcp->u_arg[0]); + return do_adjtimex(tcp, print_timex, tcp->u_arg[0]); return 0; } @@ -256,7 +257,7 @@ SYS_FUNC(clock_nanosleep) SYS_FUNC(clock_adjtime) { if (exiting(tcp)) - return do_adjtimex(tcp, tcp->u_arg[1]); + return do_adjtimex(tcp, print_timex, tcp->u_arg[1]); printclockname(tcp->u_arg[0]); tprints(", "); return 0;