be1cf9006a
The exit of init panics the system *after* process context (mm, stack, ...etc.) are recycled, according to Linux kernel's 'do_exit' implementation. To preserve most init process context for debugging, triggers the panic via proc-sysrq explicitly. Note: after this change, there will be no "Attempt to kill init" panic when androidboot.init_fatal_panic is set. Test: Insert data abort fault in init, the full process context is preserved in memory dump captured after panic. Bug: 155940351 Change-Id: I3393bd00f99b8cb432cfa19a105b7d636b411764
36 lines
1.2 KiB
C++
36 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2010 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#define PROC_SYSRQ "/proc/sysrq-trigger"
|
|
|
|
namespace android {
|
|
namespace init {
|
|
|
|
void SetFatalRebootTarget();
|
|
// Determines whether the system is capable of rebooting. This is conservative,
|
|
// so if any of the attempts to determine this fail, it will still return true.
|
|
bool IsRebootCapable();
|
|
// This is a wrapper around the actual reboot calls.
|
|
void __attribute__((noreturn)) RebootSystem(unsigned int cmd, const std::string& reboot_target);
|
|
void __attribute__((noreturn)) InitFatalReboot(int signal_number);
|
|
void InstallRebootSignalHandlers();
|
|
|
|
} // namespace init
|
|
} // namespace android
|