Merge "InitFatalReboot: Panic the system if init_fatal_panic is "true""
am: d377ad8b06
Change-Id: I0c7dd0272adeaa0d85f3d2d7064e75e7381a777e
This commit is contained in:
commit
2af792be76
1 changed files with 7 additions and 0 deletions
|
@ -34,12 +34,16 @@ namespace android {
|
|||
namespace init {
|
||||
|
||||
static std::string init_fatal_reboot_target = "bootloader";
|
||||
static bool init_fatal_panic = false;
|
||||
|
||||
void SetFatalRebootTarget() {
|
||||
std::string cmdline;
|
||||
android::base::ReadFileToString("/proc/cmdline", &cmdline);
|
||||
cmdline = android::base::Trim(cmdline);
|
||||
|
||||
const char kInitFatalPanicString[] = "androidboot.init_fatal_panic=true";
|
||||
init_fatal_panic = cmdline.find(kInitFatalPanicString) != std::string::npos;
|
||||
|
||||
const char kRebootTargetString[] = "androidboot.init_fatal_reboot_target=";
|
||||
auto start_pos = cmdline.find(kRebootTargetString);
|
||||
if (start_pos == std::string::npos) {
|
||||
|
@ -133,6 +137,9 @@ void __attribute__((noreturn)) InitFatalReboot(int signal_number) {
|
|||
for (size_t i = 0; i < backtrace->NumFrames(); i++) {
|
||||
LOG(ERROR) << backtrace->FormatFrameData(i);
|
||||
}
|
||||
if (init_fatal_panic) {
|
||||
_exit(signal_number);
|
||||
}
|
||||
RebootSystem(ANDROID_RB_RESTART2, init_fatal_reboot_target);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue