diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2015-09-18 18:02:50 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2015-09-19 04:04:49 +0300 |
commit | 4cb5ccca247ca1560ce711e35c430805034e4c6b (patch) | |
tree | cbabbf9737764e37e81300dc858a9c9473d014b3 /desc.c | |
parent | 2950de36314b5ea88a3741e24f948113358f7ce2 (diff) | |
download | strace-4cb5ccca247ca1560ce711e35c430805034e4c6b.tar.gz |
Convert another parser of struct timeval to new mpers infrastructure
* print_time.c (sprint_timeval): New mpers printer.
[ALPHA] (sprint_timeval32): New function.
* defs.h [ALPHA] (sprint_timeval32): New prototype.
(bitness_t, TIMEVAL_TEXT_BUFSIZE, printtv_bitness, sprinttv): Remove.
* desc.c (decode_select): Replace bitness parameter with two printers.
Use them instead of printtv_bitness and sprinttv.
(sys_oldselect, sys_select): Pass print_timeval and sprint_timeval
to decode_select.
[ALPHA] (sys_osf_select): Pass print_timeval32 and sprint_timeval32
to decode_select.
(pselect6): Pass print_timespec and sprint_timespec to decode_select.
* time.c (UTIME_NOW, UTIME_OMIT, current_time_t_is_compat,
struct timeval32, printtv_bitness, do_sprinttv, sprinttv): Remove.
Diffstat (limited to 'desc.c')
-rw-r--r-- | desc.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -282,7 +282,9 @@ SYS_FUNC(getdtablesize) #endif static int -decode_select(struct tcb *tcp, long *args, enum bitness_t bitness) +decode_select(struct tcb *tcp, long *args, + void (*print_tv_ts) (struct tcb *, const long), + const char * (*sprint_tv_ts) (struct tcb *, const long)) { int i, j; int nfds, fdsize; @@ -334,7 +336,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness) } free(fds); tprints(", "); - printtv_bitness(tcp, args[4], bitness, 0); + print_tv_ts(tcp, args[4]); } else { static char outstr[1024]; char *outptr; @@ -388,9 +390,9 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness) free(fds); /* This contains no useful information on SunOS. */ if (args[4]) { - if (outptr < end_outstr - (10 + TIMEVAL_TEXT_BUFSIZE)) { - outptr += sprintf(outptr, "%sleft ", sep); - outptr = sprinttv(outptr, tcp, args[4], bitness, /*special:*/ 0); + const char *str = sprint_tv_ts(tcp, args[4]); + if (outptr + sizeof("left ") + strlen(sep) + strlen(str) < end_outstr) { + outptr += sprintf(outptr, "%sleft %s", sep, str); } } *outptr = '\0'; @@ -421,25 +423,25 @@ SYS_FUNC(oldselect) long_args[i] = oldselect_args[i]; } #endif - return decode_select(tcp, long_args, BITNESS_CURRENT); + return decode_select(tcp, long_args, print_timeval, sprint_timeval); #undef oldselect_args } #ifdef ALPHA SYS_FUNC(osf_select) { - return decode_select(tcp, tcp->u_arg, BITNESS_32); + return decode_select(tcp, tcp->u_arg, print_timeval32, sprint_timeval32); } #endif SYS_FUNC(select) { - return decode_select(tcp, tcp->u_arg, BITNESS_CURRENT); + return decode_select(tcp, tcp->u_arg, print_timeval, sprint_timeval); } SYS_FUNC(pselect6) { - int rc = decode_select(tcp, tcp->u_arg, BITNESS_CURRENT); + int rc = decode_select(tcp, tcp->u_arg, print_timespec, sprint_timespec); if (entering(tcp)) { unsigned long data[2]; |