]> granicus.if.org Git - strace/blobdiff - mem.c
"Modernize" all old-style function parameter declarations
[strace] / mem.c
diff --git a/mem.c b/mem.c
index 337d8dc3b74d3c9f5175287c79ad64c57151c43c..4adb570c7993d23dbb7f9ffe1f6c35d4736b4ffd 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -57,8 +57,7 @@
 #endif
 
 int
-sys_brk(tcp)
-struct tcb *tcp;
+sys_brk(struct tcb *tcp)
 {
        if (entering(tcp)) {
                tprintf("%#lx", tcp->u_arg[0]);
@@ -72,8 +71,7 @@ struct tcb *tcp;
 
 #if defined(FREEBSD) || defined(SUNOS4)
 int
-sys_sbrk(tcp)
-struct tcb *tcp;
+sys_sbrk(struct tcb *tcp)
 {
        if (entering(tcp)) {
                tprintf("%lu", tcp->u_arg[0]);
@@ -187,17 +185,53 @@ static const struct xlat mmap_flags[] = {
 #endif
 #ifdef MAP_NOCORE
        { MAP_NOCORE,           "MAP_NOCORE"    },
+#endif
+#ifdef TILE
+       { MAP_CACHE_NO_LOCAL, "MAP_CACHE_NO_LOCAL" },
+       { MAP_CACHE_NO_L2, "MAP_CACHE_NO_L2" },
+       { MAP_CACHE_NO_L1, "MAP_CACHE_NO_L1" },
 #endif
        { 0,            NULL            },
 };
 
-#if !HAVE_LONG_LONG_OFF_T
+#ifdef TILE
 static
 int
-print_mmap(tcp,u_arg, offset)
-struct tcb *tcp;
-long *u_arg;
-long long offset;
+addtileflags(flags)
+long flags;
+{
+       long home = flags & _MAP_CACHE_MKHOME(_MAP_CACHE_HOME_MASK);
+       flags &= ~_MAP_CACHE_MKHOME(_MAP_CACHE_HOME_MASK);
+
+       if (flags & _MAP_CACHE_INCOHERENT) {
+               flags &= ~_MAP_CACHE_INCOHERENT;
+               if (home == MAP_CACHE_HOME_NONE) {
+                       tprintf("|MAP_CACHE_INCOHERENT");
+                       return flags;
+               }
+               tprintf("|_MAP_CACHE_INCOHERENT");
+       }
+
+       switch (home) {
+       case 0: break;
+       case MAP_CACHE_HOME_HERE: tprintf("|MAP_CACHE_HOME_HERE"); break;
+       case MAP_CACHE_HOME_NONE: tprintf("|MAP_CACHE_HOME_NONE"); break;
+       case MAP_CACHE_HOME_SINGLE: tprintf("|MAP_CACHE_HOME_SINGLE"); break;
+       case MAP_CACHE_HOME_TASK: tprintf("|MAP_CACHE_HOME_TASK"); break;
+       case MAP_CACHE_HOME_HASH: tprintf("|MAP_CACHE_HOME_HASH"); break;
+       default:
+               tprintf("|MAP_CACHE_HOME(%d)",
+                       (home >> _MAP_CACHE_HOME_SHIFT) );
+               break;
+       }
+
+       return flags;
+}
+#endif
+
+#if !HAVE_LONG_LONG_OFF_T
+static int
+print_mmap(struct tcb *tcp, long *u_arg, long long offset)
 {
        if (entering(tcp)) {
                /* addr */
@@ -213,21 +247,25 @@ long long offset;
                /* flags */
 #ifdef MAP_TYPE
                printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
+#ifdef TILE
+               addflags(mmap_flags, addtileflags(u_arg[3] & ~MAP_TYPE));
+#else
                addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
+#endif
 #else
                printflags(mmap_flags, u_arg[3], "MAP_???");
 #endif
-               /* fd (is always int, not long) */
-               tprintf(", %d, ", (int)u_arg[4]);
+               /* fd */
+               tprintf(", ");
+               printfd(tcp, u_arg[4]);
                /* offset */
-               tprintf("%#llx", offset);
+               tprintf("%#llx", offset);
        }
        return RVAL_HEX;
 }
 
 #ifdef LINUX
-int sys_old_mmap(tcp)
-struct tcb *tcp;
+int sys_old_mmap(struct tcb *tcp)
 {
        long u_arg[6];
 
@@ -274,8 +312,7 @@ struct tcb *tcp;
 #endif
 
 int
-sys_mmap(tcp)
-struct tcb *tcp;
+sys_mmap(struct tcb *tcp)
 {
        long long offset = tcp->u_arg[5];
 
@@ -297,8 +334,7 @@ struct tcb *tcp;
 
 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
 int
-sys_mmap64(tcp)
-struct tcb *tcp;
+sys_mmap64(struct tcb *tcp)
 {
 #ifdef linux
 #ifdef ALPHA
@@ -334,9 +370,10 @@ struct tcb *tcp;
                printflags(mmap_flags, u_arg[3], "MAP_???");
 #endif
                /* fd */
-               tprintf(", %ld, ", u_arg[4]);
+               tprintf(", ");
+               printfd(tcp, tcp->u_arg[4]);
                /* offset */
-               printllval(tcp, "%#llx", 5);
+               printllval(tcp, "%#llx", 5);
        }
        return RVAL_HEX;
 }
@@ -344,8 +381,7 @@ struct tcb *tcp;
 
 
 int
-sys_munmap(tcp)
-struct tcb *tcp;
+sys_munmap(struct tcb *tcp)
 {
        if (entering(tcp)) {
                tprintf("%#lx, %lu",
@@ -355,8 +391,7 @@ struct tcb *tcp;
 }
 
 int
-sys_mprotect(tcp)
-struct tcb *tcp;
+sys_mprotect(struct tcb *tcp)
 {
        if (entering(tcp)) {
                tprintf("%#lx, %lu, ",
@@ -377,13 +412,17 @@ static const struct xlat mremap_flags[] = {
 };
 
 int
-sys_mremap(tcp)
-struct tcb *tcp;
+sys_mremap(struct tcb *tcp)
 {
        if (entering(tcp)) {
                tprintf("%#lx, %lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1],
                        tcp->u_arg[2]);
                printflags(mremap_flags, tcp->u_arg[3], "MREMAP_???");
+#ifdef MREMAP_FIXED
+               if ((tcp->u_arg[3] & (MREMAP_MAYMOVE | MREMAP_FIXED)) ==
+                   (MREMAP_MAYMOVE | MREMAP_FIXED))
+                       tprintf(", %#lx", tcp->u_arg[4]);
+#endif
        }
        return RVAL_HEX;
 }
@@ -409,8 +448,7 @@ static const struct xlat madvise_cmds[] = {
 
 
 int
-sys_madvise(tcp)
-struct tcb *tcp;
+sys_madvise(struct tcb *tcp)
 {
        if (entering(tcp)) {
                tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -431,8 +469,7 @@ static const struct xlat mlockall_flags[] = {
 };
 
 int
-sys_mlockall(tcp)
-struct tcb *tcp;
+sys_mlockall(struct tcb *tcp)
 {
        if (entering(tcp)) {
                printflags(mlockall_flags, tcp->u_arg[0], "MCL_???");
@@ -455,8 +492,7 @@ static const struct xlat mctl_sync[] = {
 };
 
 int
-sys_msync(tcp)
-struct tcb *tcp;
+sys_msync(struct tcb *tcp)
 {
        if (entering(tcp)) {
                /* addr */
@@ -489,8 +525,7 @@ static const struct xlat mctl_lockas[] = {
 };
 
 int
-sys_mctl(tcp)
-struct tcb *tcp;
+sys_mctl(struct tcb *tcp)
 {
        int arg, function;
 
@@ -523,8 +558,7 @@ struct tcb *tcp;
 #endif /* MC_SYNC */
 
 int
-sys_mincore(tcp)
-struct tcb *tcp;
+sys_mincore(struct tcb *tcp)
 {
        unsigned long i, len;
        char *vec = NULL;
@@ -556,8 +590,7 @@ struct tcb *tcp;
 
 #if defined(ALPHA) || defined(FREEBSD) || defined(IA64) || defined(SUNOS4) || defined(SVR4) || defined(SPARC) || defined(SPARC64)
 int
-sys_getpagesize(tcp)
-struct tcb *tcp;
+sys_getpagesize(struct tcb *tcp)
 {
        if (exiting(tcp))
                return RVAL_HEX;
@@ -588,8 +621,7 @@ print_ldt_entry(struct modify_ldt_ldt_s *ldt_entry)
 }
 
 int
-sys_modify_ldt(tcp)
-struct tcb *tcp;
+sys_modify_ldt(struct tcb *tcp)
 {
        if (entering(tcp)) {
                struct modify_ldt_ldt_s copy;
@@ -612,8 +644,7 @@ struct tcb *tcp;
 }
 
 int
-sys_set_thread_area(tcp)
-struct tcb *tcp;
+sys_set_thread_area(struct tcb *tcp)
 {
        struct modify_ldt_ldt_s copy;
        if (entering(tcp)) {
@@ -641,8 +672,7 @@ struct tcb *tcp;
 }
 
 int
-sys_get_thread_area(tcp)
-struct tcb *tcp;
+sys_get_thread_area(struct tcb *tcp)
 {
        struct modify_ldt_ldt_s copy;
        if (exiting(tcp)) {
@@ -662,10 +692,27 @@ struct tcb *tcp;
 }
 #endif /* LINUX && __i386__ */
 
+#if defined(LINUX) && defined(M68K)
+
+int
+sys_set_thread_area(struct tcb *tcp)
+{
+       if (entering(tcp))
+               tprintf("%#lx", tcp->u_arg[0]);
+       return 0;
+
+}
+
+int
+sys_get_thread_area(struct tcb *tcp)
+{
+       return RVAL_HEX;
+}
+#endif
+
 #if defined(LINUX)
 int
-sys_remap_file_pages(tcp)
-struct tcb *tcp;
+sys_remap_file_pages(struct tcb *tcp)
 {
        if (entering(tcp)) {
                tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
@@ -724,11 +771,7 @@ static const struct xlat move_pages_flags[] = {
 
 
 static void
-get_nodes(tcp, ptr, maxnodes, err)
-struct tcb *tcp;
-unsigned long ptr;
-unsigned long maxnodes;
-int err;
+get_nodes(struct tcb *tcp, unsigned long ptr, unsigned long maxnodes, int err)
 {
        unsigned long nlongs, size, end;
 
@@ -771,11 +814,10 @@ int err;
 }
 
 int
-sys_mbind(tcp)
-struct tcb *tcp;
+sys_mbind(struct tcb *tcp)
 {
        if (entering(tcp)) {
-               tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
+               tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
                printxval(policies, tcp->u_arg[2], "MPOL_???");
                get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[4], 0);
                tprintf(", ");
@@ -785,8 +827,7 @@ struct tcb *tcp;
 }
 
 int
-sys_set_mempolicy(tcp)
-struct tcb *tcp;
+sys_set_mempolicy(struct tcb *tcp)
 {
        if (entering(tcp)) {
                printxval(policies, tcp->u_arg[0], "MPOL_???");
@@ -796,8 +837,7 @@ struct tcb *tcp;
 }
 
 int
-sys_get_mempolicy(tcp)
-struct tcb *tcp;
+sys_get_mempolicy(struct tcb *tcp)
 {
        if (exiting(tcp)) {
                int pol;
@@ -815,8 +855,7 @@ struct tcb *tcp;
 }
 
 int
-sys_move_pages(tcp)
-struct tcb *tcp;
+sys_move_pages(struct tcb *tcp)
 {
        if (entering(tcp)) {
                unsigned long npages = tcp->u_arg[1];
@@ -889,8 +928,7 @@ struct tcb *tcp;
 
 #if defined(LINUX) && defined(POWERPC)
 int
-sys_subpage_prot(tcp)
-struct tcb *tcp;
+sys_subpage_prot(struct tcb *tcp)
 {
        if (entering(tcp)) {
                unsigned long cur, end, abbrev_end, entries;