diff options
| -rw-r--r-- | sys/alpha/alpha/dump_machdep.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/alpha/alpha/dump_machdep.c b/sys/alpha/alpha/dump_machdep.c index 902cf129a7469..63f98e2ca5805 100644 --- a/sys/alpha/alpha/dump_machdep.c +++ b/sys/alpha/alpha/dump_machdep.c @@ -73,6 +73,18 @@ dumpsys(struct dumperinfo *di) strncpy(kdh.panicstring, panicstr, sizeof kdh.panicstring); kdh.parity = kerneldump_parity(&kdh); + /* + * Check if we will have enough room to save the coredump. + * The partition size needed is the sum of: + * Memory to save + header + trailer + Room to leave untouched + * at partition head. (an arbitrary amount). + */ + if (di->mediasize < + Maxmem * (off_t)PAGE_SIZE + sizeof kdh * 2 + 64*1024) { + printf("\nDump failed. Partition too small.\n"); + return; + } + dumplo = di->mediaoffset + di->mediasize - Maxmem * (off_t)PAGE_SIZE; dumplo -= sizeof kdh * 2; i = di->dumper(di->priv, &kdh, NULL, dumplo, sizeof kdh); |
