diff options
author | peter <peter@FreeBSD.org> | 2001-08-24 09:26:17 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2001-08-24 09:26:17 +0000 |
commit | 33e9a790f5a785742b1c550da5e7e0c48ac96032 (patch) | |
tree | 67a35c112ed6c3af17bc9fc1db64199ebdc2a705 /sbin/savecore | |
parent | 1baec064218e855422ffc2f826cf83bbc7911bff (diff) | |
download | FreeBSD-src-33e9a790f5a785742b1c550da5e7e0c48ac96032.zip FreeBSD-src-33e9a790f5a785742b1c550da5e7e0c48ac96032.tar.gz |
Banish hard-coded KERNBASE references from savecore. Dynamically
adjust to whatever kernbase is in the kernel that we are dumping.
Diffstat (limited to 'sbin/savecore')
-rw-r--r-- | sbin/savecore/savecore.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index 2d33858..5e1a001 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -70,7 +70,7 @@ static const char rcsid[] = #endif #ifdef __i386__ -#define ok(number) ((number) - KERNBASE) +#define ok(number) ((number) - kernbase) #endif struct nlist current_nl[] = { /* Namelist for currently running system. */ @@ -86,6 +86,8 @@ struct nlist current_nl[] = { /* Namelist for currently running system. */ { "_panicstr" }, #define X_DUMPMAG 5 { "_dumpmag" }, +#define X_KERNBASE 6 + { "_kernbase" }, { "" }, }; int cursyms[] = { X_DUMPLO, X_VERSION, X_DUMPMAG, -1 }; @@ -98,6 +100,7 @@ struct nlist dump_nl[] = { /* Name list for dumped system. */ { "_version" }, { "_panicstr" }, { "_dumpmag" }, + { "_kernbase" }, { "" }, }; @@ -118,6 +121,10 @@ char panic_mesg[1024]; /* panic message */ int panicstr; /* flag: dump was caused by panic */ char vers[1024]; /* version of kernel that crashed */ +#ifdef __i386__ +u_long kernbase; /* offset of kvm to core file */ +#endif + int clear, compress, force, verbose; /* flags */ int keep; /* keep dump on device */ @@ -251,6 +258,13 @@ kmem_setup() exit(1); } +#ifdef __i386__ + if (dump_nl[X_KERNBASE].n_value != 0) + kernbase = dump_nl[X_KERNBASE].n_value; + else + kernbase = KERNBASE; +#endif + len = sizeof dumpdev; if (sysctlbyname("kern.dumpdev", &dumpdev, &len, NULL, 0) == -1) { syslog(LOG_ERR, "sysctl: kern.dumpdev: %m"); |