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.
diff --git a/desc.c b/desc.c
index ea9f3bd..0093538 100644
--- a/desc.c
+++ b/desc.c
@@ -282,7 +282,9 @@
#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 @@
}
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 @@
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 @@
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];