summaryrefslogtreecommitdiff
path: root/desc.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2006-12-13 17:10:11 +0000
committerDmitry V. Levin <ldv@altlinux.org>2006-12-13 17:10:11 +0000
commita7945a3d4e144674a8dd1d885e7086bc274e391b (patch)
treed0fd8f9ac31e16987540f7200c3b2307a210a453 /desc.c
parent4ebb4e3d312bb8215f4eea9130cce6bb8bdb972f (diff)
downloadstrace-a7945a3d4e144674a8dd1d885e7086bc274e391b.tar.gz
strace-a7945a3d4e144674a8dd1d885e7086bc274e391b.tar.bz2
strace-a7945a3d4e144674a8dd1d885e7086bc274e391b.tar.xz
2006-12-10 Dmitry V. Levin <ldv@altlinux.org>
Add biarch support for "struct timeval". * defs.h (bitness_t): New enum type. (printtv_bitness, sprinttv): New function prototypes. (printtv): Convert to macro wrapper around printtv_bitness(). (printtv32): Remove. * desc.c (decode_select): Use printtv_bitness() and sprinttv(). (sys_oldselect, sys_osf_select, sys_select, sys_pselect6): Update decode_select() use. * file.c [ALPHA] (sys_osf_utimes): Use printtv_bitness(). * time.c (printtv_bitness, sprinttv): New functions. (printtv, printtv32): Remove. [ALPHA] (sys_osf_settimeofday, sys_osf_settimeofday): Use printtv_bitness(). Fixes RH#171626, RH#173050.
Diffstat (limited to 'desc.c')
-rw-r--r--desc.c58
1 files changed, 12 insertions, 46 deletions
diff --git a/desc.c b/desc.c
index c3a7e6c..6e534da 100644
--- a/desc.c
+++ b/desc.c
@@ -401,22 +401,12 @@ struct tcb *tcp;
#endif /* ALPHA || FREEBSD || SUNOS4 */
static int
-decode_select(tcp, args, bitness)
-struct tcb *tcp;
-long *args;
-int bitness;
+decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
{
int i, j, nfds;
unsigned int fdsize = ((((args[0] + 7) / 8) + sizeof(long) - 1)
& -sizeof(long));
fd_set *fds;
- struct timeval tv;
-#ifdef ALPHA
- struct timeval32 {
- unsigned tv_sec;
- unsigned tv_usec;
- } *tv32;
-#endif
static char outstr[1024];
char *sep;
long arg;
@@ -451,22 +441,8 @@ int bitness;
tprintf("]");
}
free(fds);
- if (!args[4])
- tprintf(", NULL");
- else if (!verbose(tcp))
- tprintf(", %#lx", args[4]);
- else if (umove(tcp, args[4], &tv) < 0)
- tprintf(", {...}");
- else {
-#ifdef ALPHA
- if (bitness) {
- tv32=(struct timeval32*)&tv;
- tprintf(", {%u, %u}", tv32->tv_sec, tv32->tv_usec);
- } else
-#endif
- tprintf(", {%lu, %lu}",
- (long) tv.tv_sec, (long) tv.tv_usec);
- }
+ tprintf(", ");
+ printtv_bitness(tcp, args[4], bitness);
}
else
{
@@ -522,22 +498,12 @@ int bitness;
#ifdef LINUX
/* This contains no useful information on SunOS. */
if (args[4]) {
- char str[64];
+ char str[128];
- if (umove(tcp, args[4], &tv) >= 0) {
-#ifdef ALPHA
- if (bitness) {
- tv32=(struct timeval32*)&tv;
- sprintf(str, "%sleft {%u, %u}", sep,
- tv32->tv_sec, tv32->tv_usec);
- } else
-#endif
- sprintf(str, "%sleft {%lu, %lu}", sep,
- (long) tv.tv_sec, (long) tv.tv_usec);
-
- if ((cumlen += strlen(str)) < sizeof(outstr))
- strcat(outstr, str);
- }
+ sprintf(str, "%sleft ", sep);
+ sprinttv(tcp, args[4], bitness, str + strlen(str));
+ if ((cumlen += strlen(str)) < sizeof(outstr))
+ strcat(outstr, str);
}
#endif /* LINUX */
return RVAL_STR;
@@ -557,7 +523,7 @@ struct tcb *tcp;
tprintf("[...]");
return 0;
}
- return decode_select(tcp, args, 0);
+ return decode_select(tcp, args, BITNESS_CURRENT);
}
#ifdef ALPHA
@@ -566,7 +532,7 @@ sys_osf_select(tcp)
struct tcb *tcp;
{
long *args = tcp->u_arg;
- return decode_select(tcp, args, 1);
+ return decode_select(tcp, args, BITNESS_32);
}
#endif
@@ -873,14 +839,14 @@ int
sys_select(tcp)
struct tcb *tcp;
{
- return decode_select(tcp, tcp->u_arg, 0);
+ return decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
}
#ifdef LINUX
int
sys_pselect6(struct tcb *tcp)
{
- int rc = decode_select(tcp, tcp->u_arg, 0);
+ int rc = decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
if (exiting(tcp)) {
struct {
void *ss;