Restore tcb::u_lrval; fix lseek on MIPS-n32
Linux kernel v3.4 adds x32 support. Both x32 and n32 use 64bit offset
for lseek parameter and return value. We need u_lrval to handle it
properly. Also we shouldn't check HAVE_LONG_LONG_OFF_T for n32 lseek.
This patch fixes it properly and prepares lseek for x32.
* defs.h (tcb): Restore tcb::u_lrval field, RVAL_Lfoo constants.
Set RVAL_MASK to 7.
* file.c (sys_lseek): Print 64bit offset and return RVAL_LUDECIMAL
for n32.
* syscall.c (get_error): Set u_lrval for MIPS-n32.
(trace_syscall_exiting): Handle RVAL_Lfoo return value types.
Signed-off-by: H.J. Lu <hongjiu.lu@intel.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/syscall.c b/syscall.c
index ddc461c..7f3ff34 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1735,6 +1735,9 @@
u_error = r2;
} else {
tcp->u_rval = r2;
+# if defined(LINUX_MIPSN32)
+ tcp->u_lrval = r2;
+# endif
}
#elif defined(POWERPC)
if (check_errno && is_negated_errno(ppc_result)) {
@@ -2065,6 +2068,24 @@
case RVAL_DECIMAL:
tprintf("= %ld", tcp->u_rval);
break;
+#if defined(LINUX_MIPSN32) || defined(X32)
+ /*
+ case RVAL_LHEX:
+ tprintf("= %#llx", tcp->u_lrval);
+ break;
+ case RVAL_LOCTAL:
+ tprintf("= %#llo", tcp->u_lrval);
+ break;
+ */
+ case RVAL_LUDECIMAL:
+ tprintf("= %llu", tcp->u_lrval);
+ break;
+ /*
+ case RVAL_LDECIMAL:
+ tprintf("= %lld", tcp->u_lrval);
+ break;
+ */
+#endif
default:
fprintf(stderr,
"invalid rval format\n");