]> granicus.if.org Git - strace/blobdiff - desc.c
2004-09-03 Roland McGrath <roland@redhat.com>
[strace] / desc.c
diff --git a/desc.c b/desc.c
index b9d8d3520bd236b8511499ff6324221d7e192d5f..f4e92571f46300c810bc5aa5dbcab0e02c050725 100644 (file)
--- a/desc.c
+++ b/desc.c
 #include <fcntl.h>
 #include <sys/file.h>
 
-#if FREEBSD
+#if HAVE_LONG_LONG_OFF_T
+/*
+ * Hacks for systems that have a long long off_t
+ */
 #define flock64        flock           /* Horrid hack */
 #define printflock printflock64        /* Horrider hack */
 #endif
 
 
-static struct xlat fcntlcmds[] = {
+static const struct xlat fcntlcmds[] = {
        { F_DUPFD,      "F_DUPFD"       },
        { F_GETFD,      "F_GETFD"       },
        { F_SETFD,      "F_SETFD"       },
@@ -139,7 +142,7 @@ static struct xlat fcntlcmds[] = {
        { 0,            NULL            },
 };
 
-static struct xlat fdflags[] = {
+static const struct xlat fdflags[] = {
 #ifdef FD_CLOEXEC
        { FD_CLOEXEC,   "FD_CLOEXEC"    },
 #endif
@@ -148,7 +151,7 @@ static struct xlat fdflags[] = {
 
 #ifdef LOCK_SH
 
-static struct xlat flockcmds[] = {
+static const struct xlat flockcmds[] = {
        { LOCK_SH,      "LOCK_SH"       },
        { LOCK_EX,      "LOCK_EX"       },
        { LOCK_NB,      "LOCK_NB"       },
@@ -158,7 +161,7 @@ static struct xlat flockcmds[] = {
 
 #endif /* LOCK_SH */
 
-static struct xlat lockfcmds[] = {
+static const struct xlat lockfcmds[] = {
        { F_RDLCK,      "F_RDLCK"       },
        { F_WRLCK,      "F_WRLCK"       },
        { F_UNLCK,      "F_UNLCK"       },
@@ -171,14 +174,14 @@ static struct xlat lockfcmds[] = {
        { 0,            NULL            },
 };
 
-static struct xlat whence[] = {
+static const struct xlat whence[] = {
        { SEEK_SET,     "SEEK_SET"      },
        { SEEK_CUR,     "SEEK_CUR"      },
        { SEEK_END,     "SEEK_END"      },
        { 0,            NULL            },
 };
 
-#ifndef FREEBSD
+#ifndef HAVE_LONG_LONG_OFF_T
 /* fcntl/lockf */
 static void
 printflock(tcp, addr, getlk)
@@ -204,12 +207,12 @@ int getlk;
 }
 #endif
 
-#if _LFS64_LARGEFILE || FREEBSD
+#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
 /* fcntl/lockf */
 static void
 printflock64(tcp, addr, getlk)
 struct tcb *tcp;
-int addr;
+long addr;
 int getlk;
 {
        struct flock64 fl;
@@ -222,7 +225,7 @@ int getlk;
        printxval(lockfcmds, fl.l_type, "F_???");
        tprintf(", whence=");
        printxval(whence, fl.l_whence, "SEEK_???");
-       tprintf(", start=%lld, len=%lld", fl.l_start, fl.l_len);
+       tprintf(", start=%lld, len=%lld", (long long) fl.l_start, (long long) fl.l_len);
        if (getlk)
                tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
        else
@@ -232,7 +235,7 @@ int getlk;
 
 static char *
 sprintflags(xlat, flags)
-struct xlat *xlat;
+const struct xlat *xlat;
 int flags;
 {
        static char outstr[1024];
@@ -258,7 +261,7 @@ int
 sys_fcntl(tcp)
 struct tcb *tcp;
 {
-       extern struct xlat openmodes[];
+       extern const struct xlat openmodes[];
 
        if (entering(tcp)) {
                tprintf("%ld, ", tcp->u_arg[0]);
@@ -288,7 +291,7 @@ struct tcb *tcp;
 #ifdef F_FREESP64
                case F_FREESP64:
 #endif
-               /* Linux glibc defines SETLK64 as SETLK, 
+               /* Linux glibc defines SETLK64 as SETLK,
                   even though the kernel has different values - as does Solaris. */
 #if defined(F_SETLK64) && F_SETLK64+0!=F_SETLK
                case F_SETLK64:
@@ -537,6 +540,7 @@ struct tcb *tcp;
 }
 
 #ifdef ALPHA
+int
 sys_osf_select(tcp)
 struct tcb *tcp;
 {