]> granicus.if.org Git - strace/blobdiff - file.c
Fix signed/unsigned problems
[strace] / file.c
diff --git a/file.c b/file.c
index 678b6d9c112e1006f37a2b08dd1a3d09c0c067e5..bfb12ca30a3cfdb528690e8909f6d70e408ba275 100644 (file)
--- a/file.c
+++ b/file.c
@@ -107,11 +107,17 @@ struct stat {
 #    define off_t off_t
 #    define loff_t loff_t
 #  endif
+#  ifdef HPPA  /* asm-parisc/stat.h defines stat64 */
+#    undef stat64
+#  endif
 #  define stat libc_stat
 #  define stat64 libc_stat64
 #  include <sys/stat.h>
 #  undef stat
 #  undef stat64
+#  ifdef HPPA
+#    define stat64 hpux_stat64
+#  endif
 #else
 #  include <sys/stat.h>
 #endif
@@ -398,11 +404,11 @@ struct tcb *tcp;
        if (tcp->u_arg[4] == SEEK_SET)
            tprintf("%ld, %llu, ", tcp->u_arg[0],
                    (((long long int) tcp->u_arg[1]) << 32
-                    | (unsigned long long) tcp->u_arg[2]));
+                    | (unsigned long long) (unsigned) tcp->u_arg[2]));
        else
            tprintf("%ld, %lld, ", tcp->u_arg[0],
                    (((long long int) tcp->u_arg[1]) << 32
-                    | (unsigned long long) tcp->u_arg[2]));
+                    | (unsigned long long) (unsigned) tcp->u_arg[2]));
     }
     else {
        long long int off;
@@ -424,7 +430,7 @@ struct tcb *tcp;
        if (entering(tcp)) {
                long long offset;
                ALIGN64 (tcp, 1);       /* FreeBSD aligns off_t args */
-               offset = get64(tcp->u_arg [1], tcp->u_arg[2]);
+               offset = LONG_LONG(tcp->u_arg [1], tcp->u_arg[2]);
                if (tcp->u_arg[3] == SEEK_SET)
                        tprintf("%ld, %llu, ", tcp->u_arg[0], offset);
                else
@@ -456,7 +462,7 @@ struct tcb *tcp;
        if (entering(tcp)) {
                ALIGN64 (tcp, 1);
                printpath(tcp, tcp->u_arg[0]);
-               tprintf(", %llu", get64(tcp->u_arg[1],tcp->u_arg[2]));
+               tprintf(", %llu", LONG_LONG(tcp->u_arg[1],tcp->u_arg[2]));
        }
        return 0;
 }
@@ -482,7 +488,7 @@ struct tcb *tcp;
        if (entering(tcp)) {
                ALIGN64 (tcp, 1);
                tprintf("%ld, %llu", tcp->u_arg[0],
-                       get64(tcp->u_arg[1] ,tcp->u_arg[2]));
+                       LONG_LONG(tcp->u_arg[1] ,tcp->u_arg[2]));
        }
        return 0;
 }
@@ -624,8 +630,8 @@ long addr;
 }
 #endif /* LINUXSPARC */
 
-#ifdef FREEBSD
 static struct xlat fileflags[] = {
+#ifdef FREEBSD
        { UF_NODUMP,    "UF_NODUMP"     },
        { UF_IMMUTABLE, "UF_IMMUTABLE"  },
        { UF_APPEND,    "UF_APPEND"     },
@@ -635,9 +641,18 @@ static struct xlat fileflags[] = {
        { SF_IMMUTABLE, "SF_IMMUTABLE"  },
        { SF_APPEND,    "SF_APPEND"     },
        { SF_NOUNLINK,  "SF_NOUNLINK"   },
+#elif UNIXWARE >= 2
+#ifdef         _S_ISMLD
+       { _S_ISMLD,     "_S_ISMLD"      },
+#endif
+#ifdef         _S_ISMOUNTED
+       { _S_ISMOUNTED, "_S_ISMOUNTED"  },
+#endif
+#endif
        { 0,            NULL            },
 };
 
+#ifdef FREEBSD
 int
 sys_chflags(tcp)
 struct tcb *tcp;
@@ -712,7 +727,28 @@ struct stat *statbuf;
     if (!abbrev(tcp)) {
            tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
            tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
-           tprintf("st_ctime=%s}", sprinttime(statbuf->st_ctime));
+           tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
+#if HAVE_ST_FLAGS
+               tprintf(", st_flags=");
+               if (statbuf->st_flags) {
+                       printflags(fileflags, statbuf->st_flags);
+               } else
+                       tprintf("0");
+#endif
+#if HAVE_ST_ACLCNT
+               tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
+#endif
+#if HAVE_ST_LEVEL
+               tprintf(", st_level=%ld", statbuf->st_level);
+#endif
+#if HAVE_ST_FSTYPE
+               tprintf(", st_fstype=%.*s",
+                       (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
+#endif
+#if HAVE_ST_GEN
+               tprintf(", st_gen=%u", statbuf->st_gen);
+#endif
+               tprintf("}");
     }
     else
            tprintf("...}");
@@ -825,24 +861,35 @@ long addr;
        if (!abbrev(tcp)) {
                tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
                tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
-#ifndef FREEBSD
-               tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
-#else /* FREEBSD */
-               tprintf("st_ctime=%s, ", sprinttime(statbuf.st_ctime));
-               tprintf("st_flags=");
+               tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
+#if HAVE_ST_FLAGS
+               tprintf(", st_flags=");
                if (statbuf.st_flags) {
                        printflags(fileflags, statbuf.st_flags);
                } else
                        tprintf("0");
-               tprintf(", st_gen=%u}", statbuf.st_gen);
-#endif /* FREEBSD */
+#endif
+#if HAVE_ST_ACLCNT
+               tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
+#endif
+#if HAVE_ST_LEVEL
+               tprintf(", st_level=%ld", statbuf.st_level);
+#endif
+#if HAVE_ST_FSTYPE
+               tprintf(", st_fstype=%.*s",
+                       (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
+#endif
+#if HAVE_ST_GEN
+               tprintf(", st_gen=%u", statbuf.st_gen);
+#endif
+               tprintf("}");
        }
        else
                tprintf("...}");
 }
 #endif /* HAVE_STAT64 */
 
-#if defined(linux) && !defined(IA64)
+#if defined(linux) && !defined(IA64) && !defined(HPPA)
 static void
 convertoldstat(oldbuf, newbuf)
 const struct __old_kernel_stat *oldbuf;
@@ -930,7 +977,7 @@ struct tcb *tcp;
 }
 
 #ifdef linux
-# if !defined(IA64)
+# if !defined(IA64) && !defined(HPPA)
 int
 sys_oldstat(tcp)
 struct tcb *tcp;
@@ -943,7 +990,7 @@ struct tcb *tcp;
        }
        return 0;
 }
-# endif /* !IA64 */
+# endif /* !IA64 && !HPPA*/
 #endif /* linux */
 
 #ifndef HAVE_LONG_LONG_OFF_T
@@ -977,7 +1024,7 @@ struct tcb *tcp;
 }
 
 #ifdef linux
-# if !defined(IA64)
+# if !defined(IA64) && !defined(HPPA)
 int
 sys_oldfstat(tcp)
 struct tcb *tcp;
@@ -989,7 +1036,7 @@ struct tcb *tcp;
        }
        return 0;
 }
-# endif /* !IA64 */
+# endif /* !IA64 && !HPPA*/
 #endif
 
 #ifndef HAVE_LONG_LONG_OFF_T
@@ -1025,7 +1072,7 @@ struct tcb *tcp;
 }
 
 #ifdef linux
-# if !defined(IA64)
+# if !defined(IA64) && !defined(HPPA)
 int
 sys_oldlstat(tcp)
 struct tcb *tcp;
@@ -1038,7 +1085,7 @@ struct tcb *tcp;
        }
        return 0;
 }
-# endif /* !IA64 */
+# endif /* !IA64 && !HPPA */
 #endif