]> granicus.if.org Git - strace/blobdiff - defs.h
Fix off_t args on FreeBSD
[strace] / defs.h
diff --git a/defs.h b/defs.h
index ba65f84a6a623aeeb14fc1262013cc036f973a31..1b967ccc83b6ea7d42e62b1684bb4b899d284a8f 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -497,14 +497,38 @@ extern char *signalent2[];
 extern int nsignals2;
 #endif /* SUPPORTED_PERSONALITIES >= 3 */
 
-#if _LFS64_LARGEFILE
+#if FREEBSD
+/* ARRGH!  off_t args are aligned on 64 bit boundaries! */
+#define ALIGN64(tcp,arg)                                               \
+do {                                                                   \
+       if (arg % 2)                                                    \
+           memmove (&tcp->u_arg[arg], &tcp->u_arg[arg + 1],            \
+                    (tcp->u_nargs - arg - 1) * sizeof tcp->u_arg[0]);  \
+} while (0)
+#else
+#define ALIGN64(tcp,arg) do { } while (0)
+#endif
+
+#if _LFS64_LARGEFILE || FREEBSD
+
 /* _l refers to the lower numbered u_arg,
  * _h refers to the higher numbered u_arg
  */
-#if _LITTLE_ENDIAN || I386     /* FIXME! */
+
+#if 1
+/* This should work, assuming we can do non-aligned 64 bit fetches.
+ * if not we'll have to figure out how which of the other versions to use.
+ */
+
+#define get64(_l,_h) (*(long long *) &(_l))
+
+#else
+
+#if _LITTLE_ENDIAN
 #define get64(_l,_h) ((long long)((unsigned long long)(_l) | ((unsigned long long)(_h)<<32)))
 #else
 #define get64(_l,_h) ((long long)((unsigned long long)(_h) | ((unsigned long long)(_l)<<32)))
 #endif
 #endif
+#endif