[PATCH 33/33] Support check

Janani Venkataraman
2014-03-20T09:44:17Z

This checks if a particular build can support dumps on 32/64 bit applications.

For eg. A 32bit build of gencore cant support dumps on 64 bit applications.

Signed-off-by: Janani Venkataraman <jananive@linux.vnet.ibm.com>
---
src/coredump.c | 11 +++++++++++
src/elf64.c | 2 ++
2 files changed, 13 insertions(+)

diff --git a/src/coredump.c b/src/coredump.c
index 98a7146..49af7b3 100644
--- a/src/coredump.c
+++ b/src/coredump.c
@@ -76,6 +76,17 @@ struct core_proc cp;
/* PID of Daemon */
int pid_log;

+/* Support Check */
+static int support_check(int pid, struct core_proc *cp)
+{
+ gencore_log("This build of gencore(32bit) cannot dump a 64bit process.\n");
+ return -1;
+}
+
+#if defined(__i386) || (defined(__s390__) && !defined(__s390x__)) || (defined(__PPC__) && !defined(__PPC64__))
+#define do_elf64_coredump support_check
+#endif
+
/* Initialised core process members */
void init_core(void)
{
diff --git a/src/elf64.c b/src/elf64.c
index 651f218..11c8c76 100644
--- a/src/elf64.c
+++ b/src/elf64.c
@@ -28,6 +28,7 @@
* and operations once elf.c is included.
*/

+#if defined(__x86_64) || (defined(__s390x__) && defined(__s390__)) || (defined(__PPC64__) && defined(__PPC__))
#define do_elf_coredump do_elf64_coredump

#define Elf_Ehdr Elf64_Ehdr
@@ -40,3 +41,4 @@
#define Elf_Addr Elf64_Addr

#include "elf.c"
+#endif