]> granicus.if.org Git - strace/commitdiff
x86_64, x32: add a replacement for <asm/stat.h>
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 4 Dec 2015 15:00:37 +0000 (15:00 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 4 Dec 2015 15:22:58 +0000 (15:22 +0000)
Some old kernel headers, Ubuntu 14.04 in particular, provide
<asm/stat.h> editions that are completely wrong for x32.
Workaround this issue by providing a replacement.

* linux/x86_64/asm_stat.h: New file.
* linux/x32/asm_stat.h: Likewise.
* Makefile.am (strace_SOURCES): Add them.

Makefile.am
linux/x32/asm_stat.h [new file with mode: 0644]
linux/x86_64/asm_stat.h [new file with mode: 0644]

index efee8532009245310f61490f7bb437706ae1eaa7..0ed722edfcd66dc13af734644013db8ce9c73001 100644 (file)
@@ -92,6 +92,8 @@ strace_SOURCES =      \
        ldt.c           \
        link.c          \
        linux/asm_stat.h \
+       linux/x32/asm_stat.h \
+       linux/x86_64/asm_stat.h \
        lookup_dcookie.c \
        loop.c          \
        lseek.c         \
diff --git a/linux/x32/asm_stat.h b/linux/x32/asm_stat.h
new file mode 100644 (file)
index 0000000..865aa4a
--- /dev/null
@@ -0,0 +1 @@
+#include "x86_64/asm_stat.h"
diff --git a/linux/x86_64/asm_stat.h b/linux/x86_64/asm_stat.h
new file mode 100644 (file)
index 0000000..53042c5
--- /dev/null
@@ -0,0 +1,55 @@
+#if defined __x86_64__ && defined __ILP32__
+
+/*
+ * This is a replacement for x32 <asm/stat.h> which
+ * appears to be wrong in older kernel headers.
+ */
+
+# ifndef STRACE_ASM_STAT_H
+
+#  define STRACE_ASM_STAT_H
+
+#  include "kernel_types.h"
+
+struct stat {
+       kernel_ulong_t  st_dev;
+       kernel_ulong_t  st_ino;
+       kernel_ulong_t  st_nlink;
+       unsigned int    st_mode;
+       unsigned int    st_uid;
+       unsigned int    st_gid;
+       unsigned int    pad0__;
+       kernel_ulong_t  st_rdev;
+       kernel_long_t   st_size;
+       kernel_long_t   st_blksize;
+       kernel_long_t   st_blocks;
+       kernel_ulong_t  st_atime;
+       kernel_ulong_t  st_atime_nsec;
+       kernel_ulong_t  st_mtime;
+       kernel_ulong_t  st_mtime_nsec;
+       kernel_ulong_t  st_ctime;
+       kernel_ulong_t  st_ctime_nsec;
+       kernel_long_t   pad1__[3];
+};
+
+struct __old_kernel_stat {
+       unsigned short st_dev;
+       unsigned short st_ino;
+       unsigned short st_mode;
+       unsigned short st_nlink;
+       unsigned short st_uid;
+       unsigned short st_gid;
+       unsigned short st_rdev;
+       unsigned int  st_size;
+       unsigned int  st_atime;
+       unsigned int  st_mtime;
+       unsigned int  st_ctime;
+};
+
+# endif /* !STRACE_ASM_STAT_H */
+
+#else
+
+# include "linux/asm_stat.h"
+
+#endif