提交 df4712e9 编写于 作者: S shuqinglin 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/startup_init_lite into lsq_0518_01

......@@ -271,7 +271,7 @@ static int hookTraversalProc(ListNode *node, void *cookie)
if ((args != NULL) && (args->preHook != NULL)) {
args->preHook(&hookInfo);
}
hookInfo.retVal = hookItem->hook(hookInfo.stage, hookItem->prio, args->cookie);
hookInfo.retVal = hookItem->hook(hookInfo.stage, hookItem->prio, hookInfo.cookie);
if ((args != NULL) && (args->postHook != NULL)) {
args->postHook(&hookInfo);
}
......
......@@ -22,6 +22,7 @@
#include <dirent.h>
#include <linux/limits.h>
#include "beget_ext.h"
#include "list.h"
#include "securec.h"
#include "modulemgr.h"
......@@ -127,11 +128,13 @@ static void *moduleInstall(MODULE_ITEM *module, int argc, const char *argv[])
return NULL;
}
}
BEGET_LOGV("moduleInstall path %s", path);
currentInstallArgs = &(module->moduleMgr->installArgs);
handle = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
currentInstallArgs = NULL;
if (handle == NULL) {
BEGET_LOGE("moduleInstall path %s fail %d", path, errno);
}
return handle;
}
......
......@@ -86,4 +86,5 @@ useriam:x:1088:
backup:x:1089:
storage_manager:1090:
net_manager:x:1099:
edm:x:3057:
\ No newline at end of file
edm:x:3057:
account:x:3058:
......@@ -174,7 +174,7 @@
"mkdir /data/system 0775 system system",
"mkdir /data/system/dropbox 0700 system system",
"mkdir /data/system/heapdump 0700 system system",
"mkdir /data/system/users 0775 system system",
"mkdir /data/system/users 0750 account account",
"mkdir /data/system/access_token 0770 access_token access_token",
"mkdir /data/system_de 0770 system system",
"mkdir /data/system_ce 0770 system system",
......
......@@ -163,7 +163,7 @@
"mkdir /data/system 0775 system system",
"mkdir /data/system/dropbox 0700 system system",
"mkdir /data/system/heapdump 0700 system system",
"mkdir /data/system/users 0775 system system",
"mkdir /data/system/users 0750 account account",
"mkdir /data/system/access_token 0770 access_token access_token",
"mkdir /data/system_de 0770 system system",
"mkdir /data/system_ce 0770 system system",
......
......@@ -89,4 +89,4 @@ backup:x:1089:1089:::/bin/false
storage_manager:x:1090:1090:::/bin/false
net_manager:x:1099:1099:::/bin/false
edm:x:3057:3057:::/bin/false
account:x:3058:3058:::/bin/false
......@@ -268,7 +268,7 @@ static int BindCpuCore(Service *service)
static void ClearEnvironment(Service *service)
{
if (strcmp(service->name, "appspawn") != 0) {
if (strcmp(service->name, "appspawn") != 0 && strcmp(service->name, "nwebspawn") != 0) {
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGCHLD);
......
......@@ -29,7 +29,8 @@ enum INIT_BOOTSTAGE {
INIT_PRE_PARAM_SERVICE = 10,
INIT_PRE_PARAM_LOAD = 20,
INIT_PRE_CFG_LOAD = 30,
INIT_POST_CFG_LOAD = 40
INIT_POST_PERSIST_PARAM_LOAD = 40,
INIT_POST_CFG_LOAD = 50
};
inline int InitAddGlobalInitHook(int prio, OhosHook hook)
......@@ -57,6 +58,10 @@ inline int InitAddPostCfgLoadHook(int prio, OhosHook hook)
return HookMgrAdd(NULL, INIT_POST_CFG_LOAD, prio, hook);
}
inline int InitAddPostPersistParamLoadHook(int prio, OhosHook hook)
{
return HookMgrAdd(NULL, INIT_POST_PERSIST_PARAM_LOAD, prio, hook);
}
#ifdef __cplusplus
#if __cplusplus
}
......
......@@ -25,7 +25,7 @@ int InitModuleMgrInstall(const char *moduleName)
}
if (defaultModuleMgr == NULL) {
defaultModuleMgr = ModuleMgrCreate(moduleName);
defaultModuleMgr = ModuleMgrCreate("init");
}
if (defaultModuleMgr == NULL) {
return -1;
......@@ -43,8 +43,11 @@ static int ModuleMgrCmdInstall(int id, const char *name, int argc, const char **
{
INIT_ERROR_CHECK(argv != NULL && argc >= 1, return -1, "Invalid install parameter");
int ret;
ret = ModuleMgrInstall(NULL, argv[0], argc-1, argv+1);
INIT_ERROR_CHECK(ret == 0, return ret, "Install module %s fail", argv[0]);
if (defaultModuleMgr == NULL) {
defaultModuleMgr = ModuleMgrCreate("init");
}
ret = ModuleMgrInstall(defaultModuleMgr, argv[0], argc-1, argv+1);
INIT_ERROR_CHECK(ret == 0, return ret, "Install module %s fail errno %d", argv[0], ret);
return 0;
}
......
......@@ -253,6 +253,8 @@ static void BootStateChange(const char *content)
}
if (strcmp("post-init", content) == 0) {
StartAllServices(START_MODE_NARMAL);
// Destroy all hooks
HookMgrDestroy(NULL);
return;
}
}
......@@ -358,9 +360,6 @@ void SystemConfig(void)
INIT_LOGI("Parse init config file done.");
HookMgrExecute(NULL, INIT_POST_CFG_LOAD, (void *)&args);
// Destroy all hooks
HookMgrDestroy(NULL);
// dump config
#if defined(OHOS_SERVICE_DUMP)
AddCmdExecutor("display", SystemDump);
......
......@@ -29,8 +29,9 @@
#include <sys/sysmacros.h>
#include <sys/wait.h>
#include <unistd.h>
#include <linux/module.h>
#include "bootstage.h"
#include "fs_manager/fs_manager.h"
#include "init_jobs_internal.h"
#include "init_log.h"
......@@ -178,8 +179,9 @@ static void DoSetParam(const struct CmdArgs *ctx)
static void DoLoadPersistParams(const struct CmdArgs *ctx)
{
INIT_LOGV("load persist params : %s", ctx->argv[0]);
INIT_LOGV("LoadPersistParams");
LoadPersistParams();
HookMgrExecute(NULL, INIT_POST_PERSIST_PARAM_LOAD, NULL);
}
static void DoTriggerCmd(const struct CmdArgs *ctx)
......
......@@ -264,14 +264,45 @@ static int DoBootchartStop(void)
return 0;
}
static int DoBootchartCmd(int id, const char *name, int argc, const char **argv)
{
PLUGIN_LOGI("DoBootchartCmd argc %d %s", argc, name);
PLUGIN_CHECK(argc >= 1, return -1, "Invalid parameter");
if (strcmp(argv[0], "start") == 0) {
return DoBootchartStart();
} else if (strcmp(argv[0], "stop") == 0) {
return DoBootchartStop();
}
return 0;
}
static int32_t g_executorId = -1;
static int BootchartInit(void)
{
if (g_executorId == -1) {
g_executorId = AddCmdExecutor("bootchart", DoBootchartCmd);
PLUGIN_LOGI("BootchartInit executorId %d", g_executorId);
}
return 0;
}
static void BootchartExit(void)
{
PLUGIN_LOGI("BootchartExit executorId %d", g_executorId);
if (g_executorId != -1) {
RemoveCmdExecutor("bootchart", g_executorId);
}
}
MODULE_CONSTRUCTOR(void)
{
PLUGIN_LOGI("DoBootchartStart now ...");
DoBootchartStart();
BootchartInit();
}
MODULE_DESTRUCTOR(void)
{
PLUGIN_LOGI("DoBootchartStop now ...");
DoBootchartStop();
BootchartExit();
}
......@@ -34,5 +34,5 @@ static int bootchartEarlyHook(int stage, int prio, void *cookie)
MODULE_CONSTRUCTOR(void)
{
// Depends on parameter service
InitAddPreCfgLoadHook(0, bootchartEarlyHook);
InitAddPostPersistParamLoadHook(0, bootchartEarlyHook);
}
......@@ -153,7 +153,6 @@ public:
if (serverTask_ == nullptr) {
return;
}
((StreamServerTask *)serverTask_)->base.handleEvent(LE_GetDefaultLoop(), serverTask_, Event_Write);
((StreamServerTask *)serverTask_)->base.handleEvent(LE_GetDefaultLoop(), serverTask_, Event_Read);
uint64_t eventId = 0;
......@@ -170,7 +169,7 @@ public:
BufferHandle handle = LE_CreateBuffer(LE_GetDefaultLoop(), 1 + sizeof(eventId));
LE_Buffer *buffer = (LE_Buffer *)handle;
AddBuffer((StreamTask *)client, buffer);
((StreamConnectTask *)client)->stream.base.handleEvent(LE_GetDefaultLoop(), (TaskHandle)(&client), Event_Write);
((StreamConnectTask *)client)->stream.base.handleEvent(LE_GetDefaultLoop(), (TaskHandle)(client), Event_Write);
ParamMessage *request = (ParamMessage *)CreateParamMessage(MSG_SET_PARAM, "name", sizeof(ParamMessage));
((StreamConnectTask *)client)->recvMessage(LE_GetDefaultLoop(), reinterpret_cast<uint8_t *>(request),
......@@ -179,7 +178,7 @@ public:
LE_Buffer *next = nullptr;
LE_Buffer *nextBuff = GetNextBuffer((StreamTask *)client, next);
if (nextBuff != nullptr) {
LE_FreeBuffer(LE_GetDefaultLoop(), (TaskHandle)&client, nextBuff);
LE_FreeBuffer(LE_GetDefaultLoop(), (TaskHandle)client, nextBuff);
}
ParamWatcher *watcher = (ParamWatcher *)ParamGetTaskUserData(client);
PARAM_CHECK(watcher != nullptr, return, "Failed to get watcher");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册