* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): New macro.
(truncate_klong_to_current_wordsize,
truncate_kulong_to_current_wordsize): Use it.
* mem.c (SYS_FUNC(old_mmap)): Likewise.
* util.c (umoven, umovestr, dumpiov_upto): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.
# endif
#endif
+#define ANY_WORDSIZE_LESS_THAN_KERNEL_LONG \
+ (SIZEOF_KERNEL_LONG_T > 4 \
+ && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined(current_wordsize)))
+
#define DECL_PRINTNUM(name) \
extern bool \
printnum_ ## name(struct tcb *, kernel_ulong_t addr, const char *fmt) \
static inline kernel_long_t
truncate_klong_to_current_wordsize(const kernel_long_t v)
{
-#if SIZEOF_KERNEL_LONG_T > 4 \
- && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined current_wordsize)
+#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
if (current_wordsize < sizeof(v)) {
return (int) v;
} else
static inline kernel_ulong_t
truncate_kulong_to_current_wordsize(const kernel_ulong_t v)
{
-#if SIZEOF_KERNEL_LONG_T > 4 \
- && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined current_wordsize)
+#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
if (current_wordsize < sizeof(v)) {
return (unsigned int) v;
} else
SYS_FUNC(old_mmap)
{
kernel_ulong_t u_arg[6];
-# ifndef current_klongsize
+# if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
/* We are here only in a 32-bit personality. */
unsigned int narrow_arg[6];
if (umove_or_printaddr(tcp, tcp->u_arg[0], &narrow_arg))
else {
switch (sys_res & RVAL_MASK) {
case RVAL_HEX:
-#if SUPPORTED_PERSONALITIES > 1
- if (current_wordsize < sizeof(tcp->u_rval))
+#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
+ if (current_wordsize < sizeof(tcp->u_rval)) {
tprintf("= %#x",
(unsigned int) tcp->u_rval);
- else
+ } else
#endif
+ {
tprintf("= %#" PRI_klx, tcp->u_rval);
+ }
break;
case RVAL_OCTAL:
tprints("= ");
print_numeric_long_umask(tcp->u_rval);
break;
case RVAL_UDECIMAL:
-#if SUPPORTED_PERSONALITIES > 1
- if (current_wordsize < sizeof(tcp->u_rval))
+#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
+ if (current_wordsize < sizeof(tcp->u_rval)) {
tprintf("= %u",
(unsigned int) tcp->u_rval);
- else
+ } else
#endif
+ {
tprintf("= %" PRI_klu, tcp->u_rval);
+ }
break;
case RVAL_DECIMAL:
tprintf("= %" PRI_kld, tcp->u_rval);
dumpiov_upto(struct tcb *const tcp, const int len, const kernel_ulong_t addr,
kernel_ulong_t data_size)
{
-#if SUPPORTED_PERSONALITIES > 1
+#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
union {
struct { uint32_t base; uint32_t len; } *iov32;
struct { uint64_t base; uint64_t len; } *iov64;
char x[sizeof(long)];
} u;
-#if SIZEOF_KERNEL_LONG_T > 4 \
- && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined current_wordsize)
+#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
if (current_wordsize < sizeof(addr)
&& (addr & (~ (kernel_ulong_t) -1U))) {
return -1;
char x[sizeof(long)];
} u;
-#if SIZEOF_KERNEL_LONG_T > 4 \
- && (SIZEOF_LONG < SIZEOF_KERNEL_LONG_T || !defined current_wordsize)
+#if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
if (current_wordsize < sizeof(addr)
&& (addr & (~ (kernel_ulong_t) -1U))) {
return -1;