2007-08-06 Jan Kratochvil <jan.kratochvil@redhat.com>
* file.c [!HAVE_STAT64 && LINUX && X86_64] (struct stat64): Define it.
[!HAVE_STAT64 && LINUX && X86_64] (HAVE_STAT64, STAT64_SIZE): Define.
[HAVE_STAT64] (printstat64) [STAT64_SIZE]: Add compile-time assertion.
Fixes RH#222275.
diff --git a/file.c b/file.c
index 6e6b306..a8af0b0 100644
--- a/file.c
+++ b/file.c
@@ -986,6 +986,38 @@
}
#endif /* !HAVE_LONG_LONG_OFF_T */
+#if !defined HAVE_STAT64 && defined LINUX && defined X86_64
+/*
+ * Linux x86_64 has unified `struct stat' but its i386 biarch needs
+ * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
+ * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
+ * __GNUC__ is needed for the required __attribute__ below.
+ */
+struct stat64 {
+ unsigned long long st_dev;
+ unsigned char __pad0[4];
+ unsigned int __st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned long long st_rdev;
+ unsigned char __pad3[4];
+ long long st_size;
+ unsigned int st_blksize;
+ unsigned long long st_blocks;
+ unsigned int st_atime;
+ unsigned int st_atime_nsec;
+ unsigned int st_mtime;
+ unsigned int st_mtime_nsec;
+ unsigned int st_ctime;
+ unsigned int st_ctime_nsec;
+ unsigned long long st_ino;
+} __attribute__((packed));
+# define HAVE_STAT64 1
+# define STAT64_SIZE 96
+#endif
+
#ifdef HAVE_STAT64
static void
printstat64(tcp, addr)
@@ -994,6 +1026,10 @@
{
struct stat64 statbuf;
+#ifdef STAT64_SIZE
+ (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
+#endif
+
#ifdef LINUXSPARC
if (current_personality == 1) {
printstatsol(tcp, addr);
@@ -2114,7 +2150,7 @@
printtv_bitness(tcp, tcp->u_arg[offset + 1],
BITNESS_CURRENT, special);
tprintf(", ");
- printtv_bitness(tcp, tcp->u_arg[offset + 1]
+ printtv_bitness(tcp, tcp->u_arg[offset + 1]
+ sizeof (struct timeval),
BITNESS_CURRENT, special);
tprintf("}");