Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
4f03dd3f
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4f03dd3f
编写于
9月 13, 2022
作者:
C
cheng_jinsong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
减少不必要依赖
Signed-off-by:
N
cheng_jinsong
<
chengjinsong2@huawei.com
>
上级
f9ff0c09
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
40 deletion
+26
-40
interfaces/innerkits/BUILD.gn
interfaces/innerkits/BUILD.gn
+1
-1
services/init/init_service_manager.c
services/init/init_service_manager.c
+6
-5
services/init/standard/init_cmds.c
services/init/standard/init_cmds.c
+14
-22
services/init/standard/switch_root.c
services/init/standard/switch_root.c
+1
-0
services/modules/bootchart/BUILD.gn
services/modules/bootchart/BUILD.gn
+0
-1
ueventd/BUILD.gn
ueventd/BUILD.gn
+0
-5
watchdog/BUILD.gn
watchdog/BUILD.gn
+4
-6
未找到文件。
interfaces/innerkits/BUILD.gn
浏览文件 @
4f03dd3f
...
...
@@ -254,7 +254,7 @@ if (defined(ohos_lite)) {
external_deps = [
"c_utils:utils",
"hilog_native:libhilog_base",
"ipc:ipc_
cor
e",
"ipc:ipc_
singl
e",
"samgr:samgr_proxy",
]
public_configs = [ ":exported_header_files" ]
...
...
services/init/init_service_manager.c
浏览文件 @
4f03dd3f
...
...
@@ -1036,6 +1036,10 @@ void ParseAllServices(const cJSON *fileRoot)
static
Service
*
GetServiceByExtServName
(
const
char
*
fullServName
)
{
INIT_ERROR_CHECK
(
fullServName
!=
NULL
,
return
NULL
,
"Failed get parameters"
);
Service
*
service
=
GetServiceByName
(
fullServName
);
if
(
service
!=
NULL
)
{
// none parameter in fullServName
return
service
;
}
char
*
tmpServName
=
strdup
(
fullServName
);
char
*
dstPtr
[
MAX_PATH_ARGS_CNT
]
=
{
NULL
};
int
returnCount
=
SplitString
(
tmpServName
,
"|"
,
dstPtr
,
MAX_PATH_ARGS_CNT
);
...
...
@@ -1043,7 +1047,7 @@ static Service *GetServiceByExtServName(const char *fullServName)
free
(
tmpServName
);
return
NULL
;
}
Service
*
service
=
GetServiceByName
(
dstPtr
[
0
]);
service
=
GetServiceByName
(
dstPtr
[
0
]);
if
(
service
==
NULL
)
{
free
(
tmpServName
);
return
NULL
;
...
...
@@ -1060,9 +1064,6 @@ static Service *GetServiceByExtServName(const char *fullServName)
for
(
extArgc
=
0
;
extArgc
<
(
returnCount
-
1
);
extArgc
++
)
{
service
->
extraArgs
.
argv
[
extArgc
+
argc
]
=
strdup
(
dstPtr
[
extArgc
+
1
]);
}
for
(
int
i
=
0
;
i
<
service
->
extraArgs
.
count
-
1
;
i
++
)
{
INIT_LOGI
(
"service->extraArgs.argv[%d] is %s"
,
i
,
service
->
extraArgs
.
argv
[
i
]);
}
service
->
extraArgs
.
argv
[
service
->
extraArgs
.
count
]
=
NULL
;
free
(
tmpServName
);
return
service
;
...
...
@@ -1102,7 +1103,7 @@ void StopAllServices(int flags, const char **exclude, int size,
int
(
*
filter
)(
const
Service
*
service
,
const
char
**
exclude
,
int
size
))
{
Service
*
service
=
GetServiceByName
(
"appspawn"
);
if
(
service
!=
NULL
&&
service
->
pid
!=
-
1
)
{
// notify appspawn stop
if
(
service
!=
NULL
&&
service
->
pid
>
0
)
{
// notify appspawn stop
#ifndef STARTUP_INIT_TEST
kill
(
service
->
pid
,
SIGTERM
);
waitpid
(
service
->
pid
,
0
,
0
);
...
...
services/init/standard/init_cmds.c
浏览文件 @
4f03dd3f
...
...
@@ -89,11 +89,12 @@ int GetParamValue(const char *symValue, unsigned int symLen, char *paramValue, u
return
0
;
}
static
int
SyncExecCommand
(
int
argc
,
char
*
const
*
argv
)
static
void
SyncExecCommand
(
int
argc
,
char
*
const
*
argv
)
{
INIT_CHECK
(
!
(
argc
==
0
||
argv
==
NULL
||
argv
[
0
]
==
NULL
),
return
-
1
);
INIT_CHECK
(
!
(
argc
==
0
||
argv
==
NULL
||
argv
[
0
]
==
NULL
),
return
);
INIT_LOGI
(
"sync exec: %s"
,
argv
[
0
]);
pid_t
pid
=
fork
();
INIT_ERROR_CHECK
(
!
(
pid
<
0
),
return
-
1
,
"Fork new process to format failed: %d"
,
errno
);
INIT_ERROR_CHECK
(
!
(
pid
<
0
),
return
,
"Fork new process to format failed: %d"
,
errno
);
if
(
pid
==
0
)
{
INIT_CHECK_ONLY_ELOG
(
execv
(
argv
[
0
],
argv
)
==
0
,
"execv %s failed! err %d."
,
argv
[
0
],
errno
);
exit
(
-
1
);
...
...
@@ -102,11 +103,10 @@ static int SyncExecCommand(int argc, char * const *argv)
pid_t
ret
=
waitpid
(
pid
,
&
status
,
0
);
if
(
ret
!=
pid
)
{
INIT_LOGE
(
"Failed to wait pid %d, errno %d"
,
pid
,
errno
);
return
ret
;
return
;
}
INIT_CHECK_ONLY_ELOG
(
!
(
!
WIFEXITED
(
status
)
||
WEXITSTATUS
(
status
)
!=
0
),
"Command %s failed with status %d"
,
argv
[
0
],
WEXITSTATUS
(
status
));
return
0
;
INIT_LOGI
(
"sync exec: %s result %d %d"
,
argv
[
0
],
WEXITSTATUS
(
status
),
WIFEXITED
(
status
));
return
;
}
static
void
DoIfup
(
const
struct
CmdArgs
*
ctx
)
...
...
@@ -198,8 +198,7 @@ static void DoSyncExec(const struct CmdArgs *ctx)
// format: syncexec /xxx/xxx/xxx xxx
INIT_ERROR_CHECK
(
ctx
!=
NULL
&&
ctx
->
argv
[
0
]
!=
NULL
,
return
,
"DoSyncExec: invalid arguments to exec
\"
%s
\"
"
,
ctx
->
argv
[
0
]);
int
ret
=
SyncExecCommand
(
ctx
->
argc
,
ctx
->
argv
);
INIT_LOGI
(
"DoSyncExec end with ret %d"
,
ret
);
SyncExecCommand
(
ctx
->
argc
,
ctx
->
argv
);
return
;
}
...
...
@@ -288,7 +287,8 @@ static void DoMakeDevice(const struct CmdArgs *ctx)
static
void
DoMountFstabFile
(
const
struct
CmdArgs
*
ctx
)
{
INIT_LOGI
(
"Mount partitions from fstab file
\"
%s
\"
"
,
ctx
->
argv
[
0
]);
(
void
)
MountAllWithFstabFile
(
ctx
->
argv
[
0
],
0
);
int
ret
=
MountAllWithFstabFile
(
ctx
->
argv
[
0
],
0
);
INIT_LOGI
(
"Mount partitions from fstab file
\"
%s
\"
finish ret %d"
,
ctx
->
argv
[
0
],
ret
);
}
static
void
DoUmountFstabFile
(
const
struct
CmdArgs
*
ctx
)
...
...
@@ -420,7 +420,6 @@ static bool InitFscryptPolicy(void)
static
void
DoInitGlobalKey
(
const
struct
CmdArgs
*
ctx
)
{
INIT_LOGI
(
"DoInitGlobalKey: start"
);
if
(
ctx
==
NULL
||
ctx
->
argc
!=
1
)
{
INIT_LOGE
(
"DoInitGlobalKey: para invalid"
);
return
;
...
...
@@ -442,13 +441,11 @@ static void DoInitGlobalKey(const struct CmdArgs *ctx)
NULL
};
int
argc
=
ARRAY_LENGTH
(
argv
);
int
ret
=
SyncExecCommand
(
argc
,
argv
);
INIT_LOGI
(
"DoInitGlobalKey: end, ret = %d"
,
ret
);
SyncExecCommand
(
argc
,
argv
);
}
static
void
DoInitMainUser
(
const
struct
CmdArgs
*
ctx
)
{
INIT_LOGI
(
"DoInitMainUser: start"
);
if
(
ctx
==
NULL
)
{
INIT_LOGE
(
"DoInitMainUser: para invalid"
);
return
;
...
...
@@ -461,13 +458,11 @@ static void DoInitMainUser(const struct CmdArgs *ctx)
NULL
};
int
argc
=
ARRAY_LENGTH
(
argv
);
int
ret
=
SyncExecCommand
(
argc
,
argv
);
INIT_LOGI
(
"DoInitMainUser: end, ret = %d"
,
ret
);
SyncExecCommand
(
argc
,
argv
);
}
static
void
DoMkswap
(
const
struct
CmdArgs
*
ctx
)
{
INIT_LOGI
(
"DoMkswap: start"
);
if
(
ctx
==
NULL
)
{
INIT_LOGE
(
"DoMkswap: para invalid"
);
return
;
...
...
@@ -478,13 +473,11 @@ static void DoMkswap(const struct CmdArgs *ctx)
NULL
};
int
argc
=
ARRAY_LENGTH
(
argv
);
int
ret
=
SyncExecCommand
(
argc
,
argv
);
INIT_LOGI
(
"DoMkswap: end, ret = %d"
,
ret
);
SyncExecCommand
(
argc
,
argv
);
}
static
void
DoSwapon
(
const
struct
CmdArgs
*
ctx
)
{
INIT_LOGI
(
"DoSwapon: start"
);
if
(
ctx
==
NULL
)
{
INIT_LOGE
(
"DoSwapon: para invalid"
);
return
;
...
...
@@ -495,8 +488,7 @@ static void DoSwapon(const struct CmdArgs *ctx)
NULL
};
int
argc
=
ARRAY_LENGTH
(
argv
);
int
ret
=
SyncExecCommand
(
argc
,
argv
);
INIT_LOGI
(
"DoSwapon: end, ret = %d"
,
ret
);
SyncExecCommand
(
argc
,
argv
);
}
static
void
DoMkSandbox
(
const
struct
CmdArgs
*
ctx
)
...
...
services/init/standard/switch_root.c
浏览文件 @
4f03dd3f
...
...
@@ -199,5 +199,6 @@ int SwitchRoot(const char *newRoot)
return
-
1
;
}
FreeRootDir
(
oldRoot
,
oldRootStat
.
st_dev
);
INIT_LOGI
(
"SwitchRoot to %s finish"
,
newRoot
);
return
0
;
}
services/modules/bootchart/BUILD.gn
浏览文件 @
4f03dd3f
...
...
@@ -23,7 +23,6 @@ ohos_shared_library("bootchart") {
]
deps = [
"//base/startup/init/interfaces/innerkits:libbegetutil",
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/cJSON:cjson_static",
]
...
...
ueventd/BUILD.gn
浏览文件 @
4f03dd3f
...
...
@@ -89,11 +89,6 @@ if (defined(ohos_lite)) {
deps = service_ueventd_deps
defines = [ "__RAMDISK__" ]
cflags = []
if (use_musl == false) {
deps += [ "//base/startup/init/services/param/base:parameterbase" ]
} else {
deps += [ "//base/startup/init/services/param/base:parameterbase_ext" ]
}
if (build_selinux) {
external_deps = [ "selinux:librestorecon" ]
cflags += [ "-DWITH_SELINUX" ]
...
...
watchdog/BUILD.gn
浏览文件 @
4f03dd3f
...
...
@@ -32,16 +32,14 @@ if (defined(ohos_lite)) {
} else {
import("//build/ohos.gni")
ohos_executable("watchdog_service") {
sources = [ "init_watchdog.c" ]
sources = [
"//base/startup/init/services/log/init_commlog.c",
"init_watchdog.c",
]
deps = [
"//base/startup/init/services/log:init_log",
"//third_party/bounds_checking_function:libsec_shared",
]
if (use_musl == false) {
deps += [ "//base/startup/init/services/param/base:parameterbase" ]
} else {
deps += [ "//base/startup/init/services/param/base:parameterbase_ext" ]
}
defines = [ "LINUX_WATCHDOG" ]
defines += [ "_GNU_SOURCE" ]
install_enable = true
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录