提交 4453b458 编写于 作者: H handyohos

bugfix: when critical process exit, panic instead of reboot

when critical process exit, panic instead of reboot
Signed-off-by: Nhandyohos <zhangxiaotian@huawei.com>
Change-Id: Idf9972da3f58639a0f9f37a926eecada0291da2b

#I65716
上级 cfa0307a
...@@ -487,6 +487,18 @@ static void CheckOndemandService(Service *service) ...@@ -487,6 +487,18 @@ static void CheckOndemandService(Service *service)
} }
} }
static void DoCriticalServiceAbnormal(void) {
FILE *panic = fopen("/proc/sysrq-trigger", "wb");
if (panic == NULL) {
ExecReboot("reboot");
return;
}
fwrite((void *)"c", 1, 1, panic);
fclose(panic);
}
void ServiceReap(Service *service) void ServiceReap(Service *service)
{ {
INIT_CHECK(service != NULL, return); INIT_CHECK(service != NULL, return);
...@@ -529,7 +541,7 @@ void ServiceReap(Service *service) ...@@ -529,7 +541,7 @@ void ServiceReap(Service *service)
if (!CalculateCrashTime(service, service->crashTime, service->crashCount)) { if (!CalculateCrashTime(service, service->crashTime, service->crashCount)) {
INIT_LOGE("Critical service \" %s \" crashed %d times, rebooting system", INIT_LOGE("Critical service \" %s \" crashed %d times, rebooting system",
service->name, service->crashCount); service->name, service->crashCount);
ExecReboot("reboot"); DoCriticalServiceAbnormal();
} }
} else if (!(service->attribute & SERVICE_ATTR_NEED_RESTART)) { } else if (!(service->attribute & SERVICE_ATTR_NEED_RESTART)) {
if (!CalculateCrashTime(service, service->crashTime, service->crashCount)) { if (!CalculateCrashTime(service, service->crashTime, service->crashCount)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册