Add the new simple helper, LOCAL_ACTIVE(). Ignoring the deprecated REMOTE()
code it is true if /bin/crash examines the live kernel on the same machine
using /dev/crash or similar device as live_memsrc.

Change fd_init() and memory_source_init() to check LOCAL_ACTIVE() instead
of ACTIVE(), both assume exactly this case when they check ACTIVE().

Currently it is equivalent to ACTIVE(), this will be changed later.

Signed-off-by: Oleg Nesterov <[email protected]>
---
 defs.h    | 1 +
 filesys.c | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/defs.h b/defs.h
index cc5db51..1c78c38 100644
--- a/defs.h
+++ b/defs.h
@@ -250,6 +250,7 @@ struct number_option {
 #define PROC_KCORE   (0x8000000000000000ULL)
 
 #define ACTIVE()            (pc->flags & LIVE_SYSTEM)
+#define LOCAL_ACTIVE()      ACTIVE()
 #define DUMPFILE()          (!(pc->flags & LIVE_SYSTEM))
 #define LIVE()              (pc->flags2 & LIVE_DUMP || pc->flags & LIVE_SYSTEM)
 #define MEMORY_SOURCES 
(NETDUMP|KDUMP|MCLXCD|LKCD|DEVMEM|S390D|MEMMOD|DISKDUMP|XENDUMP|CRASHBUILTIN|KVMDUMP|PROC_KCORE|SADUMP|VMWARE_VMSS)
diff --git a/filesys.c b/filesys.c
index f05a8cd..c291298 100644
--- a/filesys.c
+++ b/filesys.c
@@ -134,7 +134,7 @@ fd_init(void)
                        pc->nfd = -1;
                }
 
-               if (ACTIVE() && !(pc->namelist_debug || pc->system_map)) {
+               if (LOCAL_ACTIVE() && !(pc->namelist_debug || pc->system_map)) {
                        memory_source_init();
                        match_proc_version();
                }
@@ -168,7 +168,7 @@ memory_source_init(void)
        if (pc->flags & KERNEL_DEBUG_QUERY)
                return;
 
-        if (ACTIVE()) {
+        if (LOCAL_ACTIVE()) {
                if (pc->mfd != -1)  /* already been here */
                        return;
 
-- 
2.5.0

--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to