]> granicus.if.org Git - strace/commitdiff
Introduce arch-specific define HAVE_ARCH_OLD_MMAP
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 17 Jan 2018 02:18:23 +0000 (03:18 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 17 Jan 2018 04:34:49 +0000 (04:34 +0000)
* linux/arch_defs.h: New file.
* linux/aarch64/arch_defs.h: New file.  Define HAVE_ARCH_OLD_MMAP.
* linux/arm/arch_defs.h: Likewise.
* linux/i386/arch_defs.h: Likewise.
* linux/m68k/arch_defs.h: Likewise.
* linux/s390/arch_defs.h: Likewise.
* linux/s390x/arch_defs.h: Likewise.
* linux/x32/arch_defs.h: Likewise.
* linux/x86_64/arch_defs.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* defs.h: Include "arch_defs.h"
* mem.c: Replace condition for SYS_FUNC(old_mmap) with #ifdef
HAVE_ARCH_OLD_MMAP.

Suggested-by: Dmitry V. Levin <ldv@altlinux.org>
12 files changed:
Makefile.am
defs.h
linux/aarch64/arch_defs.h [new file with mode: 0644]
linux/arch_defs.h [new file with mode: 0644]
linux/arm/arch_defs.h [new file with mode: 0644]
linux/i386/arch_defs.h [new file with mode: 0644]
linux/m68k/arch_defs.h [new file with mode: 0644]
linux/s390/arch_defs.h [new file with mode: 0644]
linux/s390x/arch_defs.h [new file with mode: 0644]
linux/x32/arch_defs.h [new file with mode: 0644]
linux/x86_64/arch_defs.h [new file with mode: 0644]
mem.c

index dd1536c5ce73aa83332d971fd6503c088cd7eab7..2515876073d71eb40ea6d17c0909cb4d6e4dae75 100644 (file)
@@ -386,6 +386,7 @@ EXTRA_DIST =                                \
        linux/32/syscallent.h           \
        linux/64/ioctls_inc.h           \
        linux/64/syscallent.h           \
+       linux/aarch64/arch_defs.h       \
        linux/aarch64/arch_regs.c       \
        linux/aarch64/arch_regs.h       \
        linux/aarch64/arch_rt_sigframe.c\
@@ -431,9 +432,11 @@ EXTRA_DIST =                               \
        linux/arc/set_error.c           \
        linux/arc/set_scno.c            \
        linux/arc/syscallent.h          \
+       linux/arch_defs.h               \
        linux/arch_kvm.c                \
        linux/arch_regs.h               \
        linux/arch_sigreturn.c          \
+       linux/arm/arch_defs.h           \
        linux/arm/arch_regs.c           \
        linux/arm/arch_regs.h           \
        linux/arm/arch_rt_sigframe.c    \
@@ -515,6 +518,7 @@ EXTRA_DIST =                                \
        linux/hppa/signalent.h          \
        linux/hppa/syscallent.h         \
        linux/i386/arch_kvm.c           \
+       linux/i386/arch_defs.h          \
        linux/i386/arch_regs.c          \
        linux/i386/arch_regs.h          \
        linux/i386/arch_rt_sigframe.c   \
@@ -545,6 +549,7 @@ EXTRA_DIST =                                \
        linux/ia64/syscallent.h         \
        linux/ia64/userent.h            \
        linux/inet_diag.h               \
+       linux/m68k/arch_defs.h          \
        linux/m68k/arch_regs.c          \
        linux/m68k/arch_regs.h          \
        linux/m68k/arch_rt_sigframe.c   \
@@ -685,6 +690,7 @@ EXTRA_DIST =                                \
        linux/riscv/syscallent.h        \
        linux/riscv/syscallent1.h       \
        linux/rt_sigframe.h             \
+       linux/s390/arch_defs.h          \
        linux/s390/arch_regs.c          \
        linux/s390/arch_regs.h          \
        linux/s390/arch_rt_sigframe.c   \
@@ -701,6 +707,7 @@ EXTRA_DIST =                                \
        linux/s390/userent.h            \
        linux/s390/userent0.h           \
        linux/s390/userent1.h           \
+       linux/s390x/arch_defs.h         \
        linux/s390x/arch_regs.c         \
        linux/s390x/arch_regs.h         \
        linux/s390x/arch_rt_sigframe.c  \
@@ -810,6 +817,7 @@ EXTRA_DIST =                                \
        linux/unix_diag.h               \
        linux/userent.h                 \
        linux/userent0.h                \
+       linux/x32/arch_defs.h           \
        linux/x32/arch_kvm.c            \
        linux/x32/arch_regs.c           \
        linux/x32/arch_regs.h           \
@@ -830,6 +838,7 @@ EXTRA_DIST =                                \
        linux/x32/syscallent.h          \
        linux/x32/syscallent1.h         \
        linux/x32/userent.h             \
+       linux/x86_64/arch_defs.h        \
        linux/x86_64/arch_kvm.c         \
        linux/x86_64/arch_regs.c        \
        linux/x86_64/arch_regs.h        \
diff --git a/defs.h b/defs.h
index 7f8a10549cfd81c41ed3437d5e6c8353bed188d4..04e9c22d572b9d220fc60b8d513f2e0a9a5f739b 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -53,6 +53,7 @@
 #include <time.h>
 #include <sys/time.h>
 
+#include "arch_defs.h"
 #include "error_prints.h"
 #include "gcc_compat.h"
 #include "kernel_types.h"
diff --git a/linux/aarch64/arch_defs.h b/linux/aarch64/arch_defs.h
new file mode 100644 (file)
index 0000000..285947f
--- /dev/null
@@ -0,0 +1 @@
+#define HAVE_ARCH_OLD_MMAP 1
diff --git a/linux/arch_defs.h b/linux/arch_defs.h
new file mode 100644 (file)
index 0000000..d0d0f5b
--- /dev/null
@@ -0,0 +1 @@
+/* Fallback file for arch-specific definitions */
diff --git a/linux/arm/arch_defs.h b/linux/arm/arch_defs.h
new file mode 100644 (file)
index 0000000..285947f
--- /dev/null
@@ -0,0 +1 @@
+#define HAVE_ARCH_OLD_MMAP 1
diff --git a/linux/i386/arch_defs.h b/linux/i386/arch_defs.h
new file mode 100644 (file)
index 0000000..285947f
--- /dev/null
@@ -0,0 +1 @@
+#define HAVE_ARCH_OLD_MMAP 1
diff --git a/linux/m68k/arch_defs.h b/linux/m68k/arch_defs.h
new file mode 100644 (file)
index 0000000..285947f
--- /dev/null
@@ -0,0 +1 @@
+#define HAVE_ARCH_OLD_MMAP 1
diff --git a/linux/s390/arch_defs.h b/linux/s390/arch_defs.h
new file mode 100644 (file)
index 0000000..285947f
--- /dev/null
@@ -0,0 +1 @@
+#define HAVE_ARCH_OLD_MMAP 1
diff --git a/linux/s390x/arch_defs.h b/linux/s390x/arch_defs.h
new file mode 100644 (file)
index 0000000..285947f
--- /dev/null
@@ -0,0 +1 @@
+#define HAVE_ARCH_OLD_MMAP 1
diff --git a/linux/x32/arch_defs.h b/linux/x32/arch_defs.h
new file mode 100644 (file)
index 0000000..285947f
--- /dev/null
@@ -0,0 +1 @@
+#define HAVE_ARCH_OLD_MMAP 1
diff --git a/linux/x86_64/arch_defs.h b/linux/x86_64/arch_defs.h
new file mode 100644 (file)
index 0000000..285947f
--- /dev/null
@@ -0,0 +1 @@
+#define HAVE_ARCH_OLD_MMAP 1
diff --git a/mem.c b/mem.c
index 0ac1101340466fdb53f157e9284cc7bd70498e33..5d223a8b3580c8670ebf17be508eafd91ebfe10d 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -107,10 +107,7 @@ print_mmap(struct tcb *tcp, kernel_ulong_t *u_arg, unsigned long long offset)
  * Confused? Me too!
  */
 
-#if defined AARCH64 || defined ARM \
- || defined I386 || defined X86_64 || defined X32 \
- || defined M68K \
- || defined S390 || defined S390X
+#ifdef HAVE_ARCH_OLD_MMAP
 /* Params are pointed to by u_arg[0], offset is in bytes */
 SYS_FUNC(old_mmap)
 {
@@ -131,7 +128,7 @@ SYS_FUNC(old_mmap)
 
        return RVAL_DECODED | RVAL_HEX;
 }
-#endif /* old_mmap architectures */
+#endif /* HAVE_ARCH_OLD_MMAP */
 
 #ifdef S390
 /* Params are pointed to by u_arg[0], offset is in pages */