Merge "InitFatalReboot: Trigger panic explicitly for init_fatal_panic" am: c5f0640e48

Change-Id: I669fd71b1aa8e948fd35872e10ff5ee35b340653
This commit is contained in:
Woody Lin 2020-05-09 02:03:41 +00:00 committed by Automerger Merge Worker
commit 30820014a5
3 changed files with 6 additions and 2 deletions

View file

@ -66,8 +66,6 @@
#include "sigchld_handler.h"
#include "util.h"
#define PROC_SYSRQ "/proc/sysrq-trigger"
using namespace std::literals;
using android::base::boot_clock;

View file

@ -29,6 +29,7 @@
#include <cutils/android_reboot.h>
#include "capabilities.h"
#include "reboot_utils.h"
namespace android {
namespace init {
@ -138,6 +139,9 @@ void __attribute__((noreturn)) InitFatalReboot(int signal_number) {
LOG(ERROR) << backtrace->FormatFrameData(i);
}
if (init_fatal_panic) {
LOG(ERROR) << __FUNCTION__ << ": Trigger crash";
android::base::WriteStringToFile("c", PROC_SYSRQ);
LOG(ERROR) << __FUNCTION__ << ": Sys-Rq failed to crash the system; fallback to exit().";
_exit(signal_number);
}
RebootSystem(ANDROID_RB_RESTART2, init_fatal_reboot_target);

View file

@ -18,6 +18,8 @@
#include <string>
#define PROC_SYSRQ "/proc/sysrq-trigger"
namespace android {
namespace init {