未验证 提交 6c61f22f 编写于 作者: O openharmony_ci 提交者: Gitee

!1540 init 服务cfg 文件解析优先级采用GetCfgFiles 接口

Merge pull request !1540 from cheng_jinsong/init1121
......@@ -47,6 +47,8 @@ void SystemConfig(void);
void SystemRun(void);
void SystemExecuteRcs(void);
void ParseInitCfgByPriority(void);
int ParseInitCfg(const char *configFile, void *context);
void ReadConfig(void);
void SignalInit(void);
......
......@@ -103,8 +103,7 @@ void ReadConfig(void)
ReadFileInDir(OTHER_CHARGE_PATH, ".cfg", ParseInitCfg, NULL);
} else if (InUpdaterMode() == 0) {
ParseInitCfg(INIT_CONFIGURATION_FILE, NULL);
ReadFileInDir(OTHER_CFG_PATH, ".cfg", ParseInitCfg, NULL);
ReadFileInDir("/vendor/etc/init", ".cfg", ParseInitCfg, NULL);
ParseInitCfgByPriority();
} else {
ReadFileInDir("/etc", ".cfg", ParseInitCfg, NULL);
}
......
......@@ -50,6 +50,12 @@ void SystemPrepare(void)
{
}
void ParseInitCfgByPriority(void)
{
ReadFileInDir(OTHER_CFG_PATH, ".cfg", ParseInitCfg, NULL);
ReadFileInDir("/vendor/etc/init", ".cfg", ParseInitCfg, NULL);
}
void SystemConfig(void)
{
InitServiceSpace();
......
......@@ -370,6 +370,19 @@ INIT_STATIC void TriggerServices(int startMode)
}
}
void ParseInitCfgByPriority(void)
{
CfgFiles *files = GetCfgFiles("etc/init");
for (int i = 0; files && i < MAX_CFG_POLICY_DIRS_CNT; i++) {
if (files->paths[i]) {
if (ReadFileInDir(files->paths[i], ".cfg", ParseInitCfg, NULL) < 0) {
break;
}
}
}
FreeCfgFiles(files);
}
void SystemConfig(void)
{
INIT_TIMING_STAT timingStat;
......
......@@ -39,12 +39,14 @@ INIT_STATIC void ProcessSignal(const struct signalfd_siginfo *siginfo)
Service* service = GetServiceByPid(sigPID);
// check child process exit status
if (WIFSIGNALED(procStat)) {
INIT_LOGE("Child process %s(pid %d) exit with code : %d",
INIT_LOGE("Child process %s(pid %d) exit with signal : %d",
service == NULL ? "Unknown" : service->name, sigPID, WTERMSIG(procStat));
}
if (WIFEXITED(procStat)) {
} else if (WIFEXITED(procStat)) {
INIT_LOGE("Child process %s(pid %d) exit with code : %d",
service == NULL ? "Unknown" : service->name, sigPID, WEXITSTATUS(procStat));
} else {
INIT_LOGE("Child process %s(pid %d) exit with invalid status : %d",
service == NULL ? "Unknown" : service->name, sigPID, procStat);
}
CmdServiceProcessDelClient(sigPID);
INIT_LOGI("SigHandler, SIGCHLD received, Service:%s pid:%d uid:%d status:%d.",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册