mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-24 00:30:12 +00:00
!2315 fix param
Merge pull request !2315 from langsongping/master Change-Id: If7a676873e925da22d06617cc31d6152b4960ae5
This commit is contained in:
commit
90458fb0a7
@ -18,7 +18,7 @@ startup_param=40960
|
||||
persist_param=40960
|
||||
const_param=40960
|
||||
persist_sys_param=4096
|
||||
devinfo_public_param=30720
|
||||
devinfo_public_param=40960
|
||||
sys_param=4096
|
||||
bootevent_param=4096
|
||||
startup_init_param=40960
|
||||
|
@ -61,6 +61,8 @@
|
||||
#define TIOCSCTTY 0x540E
|
||||
#endif
|
||||
|
||||
#define DEF_CRASH_TIME 240000 // default crash time is 240000 ms
|
||||
|
||||
static int SetAllAmbientCapability(void)
|
||||
{
|
||||
for (int i = 0; i <= CAP_LAST_CAP; ++i) {
|
||||
@ -792,7 +794,9 @@ void ServiceReap(Service *service)
|
||||
}
|
||||
} else if (!(service->attribute & SERVICE_ATTR_NEED_RESTART)) {
|
||||
if (!CalculateCrashTime(service, service->crashTime, service->crashCount)) {
|
||||
INIT_LOGE("Service error %s crash %d times, no more start.", service->name, service->crashCount);
|
||||
INIT_LOGI("Service %s start failed! %d second later will reStart.", service->name, service->crashTime);
|
||||
service->crashCnt = 0;
|
||||
ServiceStartTimer(service, DEF_CRASH_TIME);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
// All service processes that init will fork+exec.
|
||||
static ServiceSpace g_serviceSpace = { 0 };
|
||||
static const int CRITICAL_DEFAULT_CRASH_TIME = 20;
|
||||
static const int CRITICAL_DEFAULT_CRASH_TIME = 240;
|
||||
// maximum number of crashes within time CRITICAL_DEFAULT_CRASH_TIME for one service
|
||||
static const int CRITICAL_DEFAULT_CRASH_COUNT = 4;
|
||||
static const int CRITICAL_CONFIG_ARRAY_LEN = 3;
|
||||
|
@ -164,16 +164,16 @@ HWTEST_F(ServiceUnitTest, TestServiceReap, TestSize.Level1)
|
||||
service->restartArg = (CmdLines *)calloc(1, sizeof(CmdLines));
|
||||
ASSERT_NE(nullptr, service->restartArg);
|
||||
ServiceReap(service);
|
||||
EXPECT_EQ(service->attribute, 0);
|
||||
EXPECT_EQ(service->attribute, SERVICE_ATTR_TIMERSTART);
|
||||
|
||||
const int crashCount = 241;
|
||||
service->crashCnt = crashCount;
|
||||
ServiceReap(service);
|
||||
EXPECT_EQ(service->attribute, 0);
|
||||
EXPECT_EQ(service->attribute, SERVICE_ATTR_TIMERSTART);
|
||||
|
||||
service->attribute |= SERVICE_ATTR_ONCE;
|
||||
ServiceReap(service);
|
||||
EXPECT_EQ(service->attribute, SERVICE_ATTR_ONCE);
|
||||
EXPECT_EQ(service->attribute, (SERVICE_ATTR_ONCE | SERVICE_ATTR_TIMERSTART));
|
||||
service->attribute = SERVICE_ATTR_CRITICAL;
|
||||
service->crashCount = 1;
|
||||
ServiceReap(service);
|
||||
|
Loading…
Reference in New Issue
Block a user