kerneldump: Add flag to indicate kernel core was successfully dumped

This allows for shutdown_final EVENTHANDLERs to know that a core dump
successfully occurred. Embedded systems may want to record this fact
or act on it.

Obtained from:	Juniper Networks, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D44542
This commit is contained in:
Stephen J. Kiernan 2024-03-27 18:55:21 -04:00
parent fe429e6794
commit 2aee804c9e
2 changed files with 5 additions and 1 deletions

View File

@ -229,6 +229,7 @@ bool scheduler_stopped __read_frequently;
int dumping __read_mostly; /* system is dumping */
int rebooting __read_mostly; /* system is rebooting */
bool dumped_core __read_mostly; /* system successfully dumped core */
/*
* Used to serialize between sysctl kern.shutdown.dumpdevname and list
* modifications via ioctl.
@ -415,8 +416,10 @@ doadump(boolean_t textdump)
TAILQ_FOREACH(di, &dumper_configs, di_next) {
error = dumpsys(di);
if (error == 0)
if (error == 0) {
dumped_core = true;
break;
}
}
}

View File

@ -358,6 +358,7 @@ struct dumperinfo {
};
extern int dumping; /* system is dumping */
extern bool dumped_core; /* system successfully dumped kernel core */
/*
* Save registers for later extraction from a kernel dump.