]> granicus.if.org Git - strace/blobdiff - io.c
Check HAVE_LONG_LONG_OFF_T when printing offset
[strace] / io.c
diff --git a/io.c b/io.c
index acc5bb5b4c93994283401ff54596d3a3da2adab9..bc5e110dd1765fcc63d561d014e94e52203262c9 100644 (file)
--- a/io.c
+++ b/io.c
 #include <sys/uio.h>
 #endif
 
-#ifdef HAVE_LONG_LONG_OFF_T
-/*
- * Hacks for systems that have a long long off_t
- */
-
-#define sys_pread64    sys_pread
-#define sys_pwrite64   sys_pwrite
-#endif
-
 int
 sys_read(struct tcb *tcp)
 {
@@ -218,6 +209,39 @@ sys_pwrite(struct tcb *tcp)
        }
        return 0;
 }
+
+#if _LFS64_LARGEFILE
+int
+sys_pread64(struct tcb *tcp)
+{
+       if (entering(tcp)) {
+               printfd(tcp, tcp->u_arg[0]);
+               tprints(", ");
+       } else {
+               if (syserror(tcp))
+                       tprintf("%#lx", tcp->u_arg[1]);
+               else
+                       printstr(tcp, tcp->u_arg[1], tcp->u_rval);
+               tprintf(", %lu, ", tcp->u_arg[2]);
+               printllval(tcp, "%#llx", 3);
+       }
+       return 0;
+}
+
+int
+sys_pwrite64(struct tcb *tcp)
+{
+       if (entering(tcp)) {
+               printfd(tcp, tcp->u_arg[0]);
+               tprints(", ");
+               printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
+               tprintf(", %lu, ", tcp->u_arg[2]);
+               printllval(tcp, "%#llx", 3);
+       }
+       return 0;
+}
+#endif /* _LFS64_LARGEFILE */
+
 #endif /* SVR4 */
 
 #ifdef FREEBSD
@@ -355,7 +379,11 @@ sys_sendfile(struct tcb *tcp)
                else if (umove(tcp, tcp->u_arg[2], &offset) < 0)
                        tprintf("%#lx", tcp->u_arg[2]);
                else
+#ifdef HAVE_LONG_LONG_OFF_T
+                       tprintf("[%llu]", offset);
+#else
                        tprintf("[%lu]", offset);
+#endif
                tprintf(", %lu", tcp->u_arg[3]);
        }
        return 0;
@@ -463,38 +491,6 @@ sys_vmsplice(struct tcb *tcp)
 }
 #endif /* LINUX */
 
-#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
-int
-sys_pread64(struct tcb *tcp)
-{
-       if (entering(tcp)) {
-               printfd(tcp, tcp->u_arg[0]);
-               tprints(", ");
-       } else {
-               if (syserror(tcp))
-                       tprintf("%#lx", tcp->u_arg[1]);
-               else
-                       printstr(tcp, tcp->u_arg[1], tcp->u_rval);
-               tprintf(", %lu, ", tcp->u_arg[2]);
-               printllval(tcp, "%#llx", 3);
-       }
-       return 0;
-}
-
-int
-sys_pwrite64(struct tcb *tcp)
-{
-       if (entering(tcp)) {
-               printfd(tcp, tcp->u_arg[0]);
-               tprints(", ");
-               printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
-               tprintf(", %lu, ", tcp->u_arg[2]);
-               printllval(tcp, "%#llx", 3);
-       }
-       return 0;
-}
-#endif
-
 int
 sys_ioctl(struct tcb *tcp)
 {