InitFatalReboot: Trigger panic explicitly for init_fatal_panic am: 8fb6e3fdaf

Change-Id: Ic38fbd15da49dd508d3bbe3b7ad34313e8919c40
This commit is contained in:
Woody Lin 2020-05-11 18:00:21 +00:00 committed by Automerger Merge Worker
commit ae467dea9b
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 {