Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
df4712e9
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
1 年多 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
df4712e9
编写于
5月 24, 2022
作者:
S
shuqinglin
提交者:
Gitee
5月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of gitee.com:openharmony/startup_init_lite into lsq_0518_01
上级
21c5286e
ce4c7986
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
65 addition
and
22 deletion
+65
-22
interfaces/innerkits/hookmgr/hookmgr.c
interfaces/innerkits/hookmgr/hookmgr.c
+1
-1
interfaces/innerkits/modulemgr/modulemgr.c
interfaces/innerkits/modulemgr/modulemgr.c
+5
-2
services/etc/group
services/etc/group
+2
-1
services/etc/init.cfg
services/etc/init.cfg
+1
-1
services/etc/init.without_two_stages.cfg
services/etc/init.without_two_stages.cfg
+1
-1
services/etc/passwd
services/etc/passwd
+1
-1
services/init/init_common_service.c
services/init/init_common_service.c
+1
-1
services/init/module_engine/include/bootstage.h
services/init/module_engine/include/bootstage.h
+6
-1
services/init/module_engine/init_modulemgr.c
services/init/module_engine/init_modulemgr.c
+6
-3
services/init/standard/init.c
services/init/standard/init.c
+2
-3
services/init/standard/init_cmds.c
services/init/standard/init_cmds.c
+4
-2
services/modules/bootchart/bootchart.c
services/modules/bootchart/bootchart.c
+32
-1
services/modules/bootchart/bootchart_static.c
services/modules/bootchart/bootchart_static.c
+1
-1
test/unittest/init/loopevent_unittest.cpp
test/unittest/init/loopevent_unittest.cpp
+2
-3
未找到文件。
interfaces/innerkits/hookmgr/hookmgr.c
浏览文件 @
df4712e9
...
...
@@ -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
);
}
...
...
interfaces/innerkits/modulemgr/modulemgr.c
浏览文件 @
df4712e9
...
...
@@ -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
;
}
...
...
services/etc/group
浏览文件 @
df4712e9
...
...
@@ -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:
services/etc/init.cfg
浏览文件 @
df4712e9
...
...
@@ -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 07
75 system system
",
"mkdir /data/system/users 07
50 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",
...
...
services/etc/init.without_two_stages.cfg
浏览文件 @
df4712e9
...
...
@@ -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 07
75 system system
",
"mkdir /data/system/users 07
50 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",
...
...
services/etc/passwd
浏览文件 @
df4712e9
...
...
@@ -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
services/init/init_common_service.c
浏览文件 @
df4712e9
...
...
@@ -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
);
...
...
services/init/module_engine/include/bootstage.h
浏览文件 @
df4712e9
...
...
@@ -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
}
...
...
services/init/module_engine/init_modulemgr.c
浏览文件 @
df4712e9
...
...
@@ -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
;
}
...
...
services/init/standard/init.c
浏览文件 @
df4712e9
...
...
@@ -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
);
...
...
services/init/standard/init_cmds.c
浏览文件 @
df4712e9
...
...
@@ -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
)
...
...
services/modules/bootchart/bootchart.c
浏览文件 @
df4712e9
...
...
@@ -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 ..."
);
DoBootchartStar
t
();
BootchartIni
t
();
}
MODULE_DESTRUCTOR
(
void
)
{
PLUGIN_LOGI
(
"DoBootchartStop now ..."
);
DoBootchartStop
();
BootchartExit
();
}
services/modules/bootchart/bootchart_static.c
浏览文件 @
df4712e9
...
...
@@ -34,5 +34,5 @@ static int bootchartEarlyHook(int stage, int prio, void *cookie)
MODULE_CONSTRUCTOR
(
void
)
{
// Depends on parameter service
InitAddP
reCfg
LoadHook
(
0
,
bootchartEarlyHook
);
InitAddP
ostPersistParam
LoadHook
(
0
,
bootchartEarlyHook
);
}
test/unittest/init/loopevent_unittest.cpp
浏览文件 @
df4712e9
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录