]> granicus.if.org Git - strace/blobdiff - mem.c
Fix signed/unsigned problems
[strace] / mem.c
diff --git a/mem.c b/mem.c
index ec9b4414324d0f406cd02d360d5a036efa0abfe1..3c08d3d54a9753e6600fe2ac58c2a865840a6568 100644 (file)
--- a/mem.c
+++ b/mem.c
 #include <asm/ldt.h>
 #endif
 
+#ifdef HAVE_LONG_LONG_OFF_T
+/*
+ * Ugly hacks for systems that have a long long off_t
+ */
+#define sys_mmap64     sys_mmap
+#endif
+
 int
 sys_brk(tcp)
 struct tcb *tcp;
@@ -153,6 +160,7 @@ static struct xlat mmap_flags[] = {
        { 0,            NULL            },
 };
 
+#if !HAVE_LONG_LONG_OFF_T
 static
 int
 print_mmap(tcp,u_arg)
@@ -223,8 +231,9 @@ struct tcb *tcp;
 {
     return print_mmap(tcp, tcp->u_arg);
 }
+#endif /* !HAVE_LONG_LONG_OFF_T */
 
-#if _LFS64_LARGEFILE
+#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
 int
 sys_mmap64(tcp)
 struct tcb *tcp;
@@ -247,6 +256,7 @@ struct tcb *tcp;
                        return 0;
 #endif /* ALPHA */
 #endif /* linux */
+               ALIGN64 (tcp, 5);       /* FreeBSD wierdies */
 
                /* addr */
                tprintf("%#lx, ", u_arg[0]);
@@ -256,12 +266,16 @@ struct tcb *tcp;
                printflags(mmap_prot, u_arg[2]);
                tprintf(", ");
                /* flags */
+#ifdef MAP_TYPE
                printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
                addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
+#else
+               printflags(mmap_flags, u_arg[3]);
+#endif
                /* fd */
                tprintf(", %ld, ", u_arg[4]);
                /* offset */
-               tprintf("%#llx", get64(u_arg[5], u_arg[6]));
+               tprintf("%#llx", LONG_LONG(u_arg[5], u_arg[6]));
        }
        return RVAL_HEX;
 }
@@ -369,11 +383,11 @@ struct tcb *tcp;
 #ifdef MS_ASYNC
 
 static struct xlat mctl_sync[] = {
-       { MS_ASYNC,     "MS_ASYNC"      },
-       { MS_INVALIDATE,"MS_INVALIDATE" },
 #ifdef MS_SYNC
        { MS_SYNC,      "MS_SYNC"       },
 #endif
+       { MS_ASYNC,     "MS_ASYNC"      },
+       { MS_INVALIDATE,"MS_INVALIDATE" },
        { 0,            NULL            },
 };