diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2015-09-18 15:16:11 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2015-09-19 04:04:49 +0300 |
commit | f1e3a320458be22ef7e308f44d0a7b80887da36b (patch) | |
tree | 3e904896bd9821f8f60b89e99bdfd7bd5aa6ce61 | |
parent | 5938526c818336357b97caa8fd89d58a12987b02 (diff) | |
download | strace-f1e3a320458be22ef7e308f44d0a7b80887da36b.tar.gz |
Convert parser of struct timeval to new mpers infrastructure
* defs.h (printtv, printtv_special): Remove.
[ALPHA] (print_timeval32, print_timeval32_pair): New prototypes.
* print_time.c (print_timeval): New mpers printer.
[ALPHA] (print_timeval32, print_timeval32_pair): New functions.
* time.c (sys_gettimeofday, sys_settimeofday): Use print_timeval
instead of printtv.
[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday):
Use print_timeval32 instead of printtv_bitness.
* utimes.c [ALPHA] (sys_osf_utimes): Use print_timeval32_pair
instead of printtv_bitness.
-rw-r--r-- | defs.h | 6 | ||||
-rw-r--r-- | print_time.c | 36 | ||||
-rw-r--r-- | time.c | 16 | ||||
-rw-r--r-- | utimes.c | 2 |
4 files changed, 47 insertions, 13 deletions
@@ -650,10 +650,6 @@ extern void printpathn(struct tcb *, long, unsigned int); #define TIMESPEC_TEXT_BUFSIZE (sizeof(long)*3 * 2 + sizeof("{%u, %u}")) #define TIMEVAL_TEXT_BUFSIZE TIMESPEC_TEXT_BUFSIZE extern void printtv_bitness(struct tcb *, long, enum bitness_t, int); -#define printtv(tcp, addr) \ - printtv_bitness((tcp), (addr), BITNESS_CURRENT, 0) -#define printtv_special(tcp, addr) \ - printtv_bitness((tcp), (addr), BITNESS_CURRENT, 1) extern char *sprinttv(char *, struct tcb *, long, enum bitness_t, int special); extern void sprint_timespec(char *, struct tcb *, long); extern void printfd(struct tcb *, int); @@ -663,6 +659,8 @@ extern void printsock(struct tcb *, long, int); extern void print_sock_optmgmt(struct tcb *, long, int); #ifdef ALPHA extern void printrusage32(struct tcb *, long); +extern void print_timeval32(struct tcb *tcp, long); +extern void print_timeval32_pair(struct tcb *tcp, long); extern void print_itimerval32(struct tcb *tcp, long); #endif extern void printuid(const char *, const unsigned int); diff --git a/print_time.c b/print_time.c index f9caf26a8..147651996 100644 --- a/print_time.c +++ b/print_time.c @@ -84,6 +84,16 @@ MPERS_PRINTER_DECL(void, print_itimerspec)(struct tcb *tcp, const long addr) tprints("}"); } +MPERS_PRINTER_DECL(void, print_timeval)(struct tcb *tcp, const long addr) +{ + timeval_t t; + + if (umove_or_printaddr(tcp, addr, &t)) + return; + + print_timeval_t(&t); +} + MPERS_PRINTER_DECL(void, print_timeval_pair)(struct tcb *tcp, const long addr) { timeval_t t[2]; @@ -137,6 +147,32 @@ print_timeval32_t(const timeval32_t *t) } void +print_timeval32(struct tcb *tcp, const long addr) +{ + timeval32_t t; + + if (umove_or_printaddr(tcp, addr, &t)) + return; + + print_timeval32_t(&t); +} + +void +print_timeval32_pair(struct tcb *tcp, const long addr) +{ + timeval32_t t[2]; + + if (umove_or_printaddr(tcp, addr, &t)) + return; + + tprints("["); + print_timeval32_t(&t[0]); + tprints(", "); + print_timeval32_t(&t[1]); + tprints("]"); +} + +void print_itimerval32(struct tcb *tcp, const long addr) { timeval32_t t[2]; @@ -139,9 +139,9 @@ sprint_timespec(char *buf, struct tcb *tcp, long addr) SYS_FUNC(gettimeofday) { if (exiting(tcp)) { - printtv(tcp, tcp->u_arg[0]); + print_timeval(tcp, tcp->u_arg[0]); tprints(", "); - printtv(tcp, tcp->u_arg[1]); + print_timeval(tcp, tcp->u_arg[1]); } return 0; } @@ -150,9 +150,9 @@ SYS_FUNC(gettimeofday) SYS_FUNC(osf_gettimeofday) { if (exiting(tcp)) { - printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); + print_timeval32(tcp, tcp->u_arg[0]); tprints(", "); - printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); + print_timeval32(tcp, tcp->u_arg[1]); } return 0; } @@ -160,9 +160,9 @@ SYS_FUNC(osf_gettimeofday) SYS_FUNC(settimeofday) { - printtv(tcp, tcp->u_arg[0]); + print_timeval(tcp, tcp->u_arg[0]); tprints(", "); - printtv(tcp, tcp->u_arg[1]); + print_timeval(tcp, tcp->u_arg[1]); return RVAL_DECODED; } @@ -170,9 +170,9 @@ SYS_FUNC(settimeofday) #ifdef ALPHA SYS_FUNC(osf_settimeofday) { - printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); + print_timeval32(tcp, tcp->u_arg[0]); tprints(", "); - printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); + print_timeval32(tcp, tcp->u_arg[1]); return RVAL_DECODED; } @@ -36,7 +36,7 @@ SYS_FUNC(osf_utimes) { printpath(tcp, tcp->u_arg[0]); tprints(", "); - printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); + print_timeval32_pair(tcp, tcp->u_arg[1]); return RVAL_DECODED; } |