Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
8e511405
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看板
未验证
提交
8e511405
编写于
3月 30, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 30, 2023
浏览文件
操作
浏览文件
下载
差异文件
!1805 启动sa进程前检查模块升级
Merge pull request !1805 from luding6/master
上级
a0e0d9a2
7b2742da
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
24 addition
and
0 deletion
+24
-0
services/init/include/init_service.h
services/init/include/init_service.h
+1
-0
services/init/include/init_service_manager.h
services/init/include/init_service_manager.h
+1
-0
services/init/init_common_service.c
services/init/init_common_service.c
+20
-0
services/init/init_service_manager.c
services/init/init_service_manager.c
+2
-0
未找到文件。
services/init/include/init_service.h
浏览文件 @
8e511405
...
...
@@ -51,6 +51,7 @@ extern "C" {
#define SERVICE_ATTR_WITHOUT_SANDBOX 0x800 // make service not enter sandbox
#define SERVICE_ATTR_NOTIFY_STATE 0x1000 // service notify state
#define SERVICE_ATTR_MODULE_UPDATE 0x2000 // module update
#define MAX_SERVICE_NAME 32
#define MAX_APL_NAME 32
...
...
services/init/include/init_service_manager.h
浏览文件 @
8e511405
...
...
@@ -37,6 +37,7 @@ extern "C" {
#define D_CAPS_STR_IN_CFG "d-caps"
#define APL_STR_IN_CFG "apl"
#define CPU_CORE_STR_IN_CFG "cpucore"
#define MODULE_UPDATE_STR_IN_CFG "module-update"
#define MAX_SERVICES_CNT_IN_FILE 100
...
...
services/init/init_common_service.c
浏览文件 @
8e511405
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
...
...
@@ -345,6 +346,22 @@ void EnterServiceSandbox(Service *service)
#endif
}
void
CheckModuleUpdate
(
int
argc
,
char
**
argv
)
{
INIT_LOGI
(
"CheckModuleUpdate start"
);
void
*
handle
=
dlopen
(
"libmodule_update.z.so"
,
RTLD_NOW
);
INIT_ERROR_CHECK
(
handle
!=
NULL
,
return
,
"dlopen module update lib failed with error:%s"
,
dlerror
());
INIT_LOGI
(
"dlopen success"
);
typedef
void
(
*
ExtFunc
)(
int
,
char
**
);
ExtFunc
func
=
(
ExtFunc
)
dlsym
(
handle
,
"CheckModuleUpdate"
);
if
(
func
==
NULL
)
{
INIT_LOGE
(
"dlsym get func failed with error:%s"
,
dlerror
());
}
else
{
func
(
argc
,
argv
);
}
INIT_LOGI
(
"CheckModuleUpdate end"
);
}
int
ServiceStart
(
Service
*
service
)
{
INIT_ERROR_CHECK
(
service
!=
NULL
,
return
SERVICE_FAILURE
,
"start service failed! null ptr."
);
...
...
@@ -371,6 +388,9 @@ int ServiceStart(Service *service)
#endif
int
pid
=
fork
();
if
(
pid
==
0
)
{
if
(
service
->
attribute
&
SERVICE_ATTR_MODULE_UPDATE
)
{
CheckModuleUpdate
(
service
->
pathArgs
.
count
,
service
->
pathArgs
.
argv
);
}
// fail must exit sub process
INIT_ERROR_CHECK
(
InitServiceProperties
(
service
)
==
0
,
_exit
(
PROCESS_EXIT_CODE
),
"Failed init service property"
);
...
...
services/init/init_service_manager.c
浏览文件 @
8e511405
...
...
@@ -850,6 +850,8 @@ int ParseOneService(const cJSON *curItem, Service *service)
INIT_ERROR_CHECK
(
ret
==
0
,
return
SERVICE_FAILURE
,
"Failed to get console for service %s"
,
service
->
name
);
ret
=
GetServiceAttr
(
curItem
,
service
,
"notify-state"
,
SERVICE_ATTR_NOTIFY_STATE
,
NULL
);
INIT_ERROR_CHECK
(
ret
==
0
,
return
SERVICE_FAILURE
,
"Failed to get notify-state for service %s"
,
service
->
name
);
ret
=
GetServiceAttr
(
curItem
,
service
,
MODULE_UPDATE_STR_IN_CFG
,
SERVICE_ATTR_MODULE_UPDATE
,
NULL
);
INIT_ERROR_CHECK
(
ret
==
0
,
return
SERVICE_FAILURE
,
"Failed to get module-update for service %s"
,
service
->
name
);
ParseOneServiceArgs
(
curItem
,
service
);
ret
=
GetServiceSandbox
(
curItem
,
service
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录