diff --git a/services/init/init_common_service.c b/services/init/init_common_service.c old mode 100644 new mode 100755 index 96be092274341c3ebb725daa49ce52ed7b488404..5006ebe2ce8d862524ac05bae6a3f7f5f7f4d9db --- a/services/init/init_common_service.c +++ b/services/init/init_common_service.c @@ -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) { INIT_CHECK(service != NULL, return); @@ -529,7 +541,7 @@ void ServiceReap(Service *service) if (!CalculateCrashTime(service, service->crashTime, service->crashCount)) { INIT_LOGE("Critical service \" %s \" crashed %d times, rebooting system", service->name, service->crashCount); - ExecReboot("reboot"); + DoCriticalServiceAbnormal(); } } else if (!(service->attribute & SERVICE_ATTR_NEED_RESTART)) { if (!CalculateCrashTime(service, service->crashTime, service->crashCount)) {