[Crash-utility] [PATCH 01/10] introduce LOCAL_ACTIVE() helper

Oleg Nesterov oleg at redhat.com
Mon Apr 25 14:48:53 UTC 2016


Add the new simple helper, LOCAL_ACTIVE(). True if crash examines the live kernel
on the same machine.

I do not really like to use MEMSRC_LOCAL; it would be better to define this helper
as ACTIVE() && !REMOTE_ACTIVE(), the last patch in series could set REM_LIVE_SYSTEM.
But this can't really work without other cleanups.

Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
 defs.h    | 1 +
 filesys.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/defs.h b/defs.h
index 56ae06c..43c0d15 100644
--- a/defs.h
+++ b/defs.h
@@ -251,6 +251,7 @@ struct number_option {
 #define PROC_KCORE   (0x8000000000000000ULL)
 
 #define ACTIVE()            (pc->flags & LIVE_SYSTEM)
+#define LOCAL_ACTIVE()      ((pc->flags & (LIVE_SYSTEM|MEMSRC_LOCAL)) == (LIVE_SYSTEM|MEMSRC_LOCAL))
 #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 9b59998..a9f54b1 100644
--- a/filesys.c
+++ b/filesys.c
@@ -123,7 +123,7 @@ fd_init(void)
 		}
 	
 		if (!pc->dumpfile) {
-			pc->flags |= LIVE_SYSTEM;
+			pc->flags |= (LIVE_SYSTEM|MEMSRC_LOCAL);
 			get_live_memory_source();
 		}
 	
-- 
2.5.0




More information about the Crash-utility mailing list