Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
92f4a2db
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,发现更多精彩内容 >>
未验证
提交
92f4a2db
编写于
10月 07, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1342 回退 set log level 提交
Merge pull request !1342 from cheng_jinsong/init1007
上级
88c71fc9
57d294da
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
15 addition
and
64 deletion
+15
-64
interfaces/innerkits/include/beget_ext.h
interfaces/innerkits/include/beget_ext.h
+1
-2
services/init/main.c
services/init/main.c
+1
-1
services/log/BUILD.gn
services/log/BUILD.gn
+0
-1
services/log/init_log.c
services/log/init_log.c
+2
-21
services/modules/bootevent/bootevent.c
services/modules/bootevent/bootevent.c
+1
-1
services/modules/init_hook/init_hook.c
services/modules/init_hook/init_hook.c
+4
-31
services/modules/init_hook/param_hook.c
services/modules/init_hook/param_hook.c
+0
-1
services/param/linux/param_request.c
services/param/linux/param_request.c
+1
-1
services/param/liteos/param_client.c
services/param/liteos/param_client.c
+1
-1
services/param/liteos/param_service.c
services/param/liteos/param_service.c
+1
-1
test/unittest/lite/cmd_func_test.cpp
test/unittest/lite/cmd_func_test.cpp
+1
-1
test/unittest/param/param_stub.cpp
test/unittest/param/param_stub.cpp
+1
-1
ueventd/ueventd_main.c
ueventd/ueventd_main.c
+1
-1
未找到文件。
interfaces/innerkits/include/beget_ext.h
浏览文件 @
92f4a2db
...
...
@@ -51,8 +51,7 @@ typedef void (*InitCommLog)(int logLevel, uint32_t domain, const char *tag, cons
#define FILE_NAME (strrchr((__FILE__), '/') ? strrchr((__FILE__), '/') + 1 : (__FILE__))
INIT_PUBLIC_API
void
StartupLog
(
InitLogLevel
logLevel
,
uint32_t
domain
,
const
char
*
tag
,
const
char
*
fmt
,
...);
INIT_PUBLIC_API
void
EnableInitLog
(
void
);
INIT_PUBLIC_API
void
SetInitLogLevel
(
InitLogLevel
level
);
INIT_PUBLIC_API
void
EnableInitLog
(
InitLogLevel
level
);
INIT_PUBLIC_API
void
SetInitCommLog
(
InitCommLog
logFunc
);
#define STARTUP_LOGV(domain, tag, fmt, ...) \
...
...
services/init/main.c
浏览文件 @
92f4a2db
...
...
@@ -30,7 +30,7 @@ int main(int argc, char * const argv[])
INIT_LOGE
(
"Process id error %d!"
,
getpid
());
return
0
;
}
EnableInitLog
();
EnableInitLog
(
INIT_INFO
);
if
(
isSecondStage
==
0
)
{
SystemPrepare
();
}
else
{
...
...
services/log/BUILD.gn
浏览文件 @
92f4a2db
...
...
@@ -17,7 +17,6 @@ config("exported_header_files") {
include_dirs = [
"//base/startup/init/interfaces/innerkits/include",
"//base/startup/init/services/log",
"//base/startup/init/services/include",
]
}
...
...
services/log/init_log.c
浏览文件 @
92f4a2db
...
...
@@ -22,7 +22,6 @@
#include <time.h>
#include <sys/time.h>
#include "param/init_param.h"
#include "securec.h"
#ifdef OHOS_LITE
#ifndef INIT_LOG_INIT
...
...
@@ -132,26 +131,8 @@ INIT_LOCAL_API void InitLog(int logLevel, unsigned int domain, const char *tag,
PrintLog
((
InitLogLevel
)
logLevel
,
domain
,
tag
,
tmpFmt
);
}
INIT_PUBLIC_API
void
SetInitLogLevel
(
InitLogLevel
level
)
INIT_PUBLIC_API
void
EnableInitLog
(
InitLogLevel
level
)
{
if
((
level
>=
INIT_DEBUG
)
&&
(
level
<=
INIT_FATAL
))
{
g_logLevel
=
level
;
}
return
;
}
INIT_PUBLIC_API
void
EnableInitLog
(
void
)
{
SetInitCommLog
(
InitLog
);
char
logLevel
[
2
]
=
{
0
};
// 2 is set param "persist.init.debug.loglevel" value length.
uint32_t
len
=
sizeof
(
logLevel
);
int
ret
=
SystemReadParam
(
"persist.init.debug.loglevel"
,
logLevel
,
&
len
);
INIT_INFO_CHECK
(
ret
==
0
,
return
,
"Can not get log level from param, keep the original loglevel."
);
errno
=
0
;
unsigned
int
level
=
(
unsigned
int
)
strtoul
(
logLevel
,
0
,
10
);
// 10 is decimal
INIT_INFO_CHECK
(
errno
==
0
,
return
,
"Failed strtoul %s, err=%d"
,
logLevel
,
errno
);
if
((
level
>=
INIT_DEBUG
)
&&
(
level
<=
INIT_FATAL
))
{
g_logLevel
=
level
;
}
return
;
}
services/modules/bootevent/bootevent.c
浏览文件 @
92f4a2db
...
...
@@ -342,7 +342,7 @@ static void SetServiceBootEventFork(SERVICE_INFO_CTX *serviceCtx)
MODULE_CONSTRUCTOR
(
void
)
{
EnableInitLog
();
EnableInitLog
(
INIT_DEBUG
);
InitAddServiceHook
(
SetServiceBootEventFork
,
INIT_SERVICE_FORK_BEFORE
);
InitAddServiceHook
(
ClearServiceBootEvent
,
INIT_SERVICE_CLEAR
);
InitAddServiceHook
(
DumpServiceBootEvent
,
INIT_SERVICE_DUMP
);
...
...
services/modules/init_hook/init_hook.c
浏览文件 @
92f4a2db
...
...
@@ -122,27 +122,9 @@ static int CmdClear(int id, const char *name, int argc, const char **argv)
return
0
;
}
static
int
CmdSetLogLevel
(
int
id
,
const
char
*
name
,
int
argc
,
const
char
**
argv
)
{
UNUSED
(
id
);
if
((
name
==
NULL
)
||
(
argv
==
NULL
)
||
(
argc
<
1
))
{
PLUGIN_LOGE
(
"Failed get log level from parameter."
);
return
-
1
;
}
char
*
value
=
strrchr
(
argv
[
0
],
'.'
);
PLUGIN_CHECK
(
value
!=
NULL
,
return
-
1
,
"Failed get
\'
.
\'
from string %s"
,
argv
[
0
]);
unsigned
int
level
;
int
ret
=
StringToUint
(
value
+
1
,
&
level
);
PLUGIN_CHECK
(
ret
==
0
,
return
-
1
,
"Failed make string to unsigned int"
);
PLUGIN_LOGI
(
"level is %d"
,
level
);
SetInitLogLevel
(
level
);
return
0
;
}
static
int
ParamSetInitCmdHook
(
const
HOOK_INFO
*
hookInfo
,
void
*
cookie
)
static
int
ParamSetBootEventHook
(
const
HOOK_INFO
*
hookInfo
,
void
*
cookie
)
{
AddCmdExecutor
(
"clear"
,
CmdClear
);
AddCmdExecutor
(
"setinitloglevel"
,
CmdSetLogLevel
);
return
0
;
}
...
...
@@ -155,7 +137,7 @@ static int DumpTrigger(const char *fmt, ...)
return
0
;
}
static
void
DumpServiceHook
(
void
)
static
int
DumpServiceHook
(
const
HOOK_INFO
*
info
,
void
*
cookie
)
{
// check and dump all jobs
char
dump
[
8
]
=
{
0
};
// 8 len
...
...
@@ -165,21 +147,12 @@ static void DumpServiceHook(void)
if
(
ret
==
0
&&
strcmp
(
dump
,
"1"
)
==
0
)
{
SystemDumpTriggers
(
1
,
DumpTrigger
);
}
return
;
}
static
int
InitDebugHook
(
const
HOOK_INFO
*
info
,
void
*
cookie
)
{
UNUSED
(
info
);
UNUSED
(
cookie
);
EnableInitLog
();
DumpServiceHook
();
return
0
;
}
MODULE_CONSTRUCTOR
(
void
)
{
InitAddGlobalInitHook
(
0
,
ParamSet
InitCmd
Hook
);
InitAddGlobalInitHook
(
0
,
ParamSet
BootEvent
Hook
);
// Depends on parameter service
InitAddPostPersistParamLoadHook
(
0
,
InitDebug
Hook
);
InitAddPostPersistParamLoadHook
(
0
,
DumpService
Hook
);
}
services/modules/init_hook/param_hook.c
浏览文件 @
92f4a2db
...
...
@@ -62,7 +62,6 @@ const ParamCmdInfo *GetOtherSpecial(size_t *size)
{
static
const
ParamCmdInfo
other
[]
=
{
{
"bootevent."
,
"bootevent."
,
"bootevent"
},
{
"persist.init.debug."
,
"persist.init.debug."
,
"setinitloglevel"
}
};
*
size
=
ARRAY_LENGTH
(
other
);
return
other
;
...
...
services/param/linux/param_request.c
浏览文件 @
92f4a2db
...
...
@@ -41,6 +41,7 @@ __attribute__((constructor)) static void ParameterInit(void)
if
(
getpid
()
==
1
)
{
return
;
}
EnableInitLog
(
INIT_ERROR
);
PARAM_WORKSPACE_OPS
ops
=
{
0
};
ops
.
updaterMode
=
0
;
#ifdef PARAM_BASE_LOG
...
...
@@ -50,7 +51,6 @@ __attribute__((constructor)) static void ParameterInit(void)
ops
.
setfilecon
=
NULL
;
#endif
InitParamWorkSpace
(
1
,
&
ops
);
EnableInitLog
();
}
__attribute__
((
destructor
))
static
void
ParameterDeinit
(
void
)
...
...
services/param/liteos/param_client.c
浏览文件 @
92f4a2db
...
...
@@ -26,13 +26,13 @@ static int InitParamClient(void)
if
(
PARAM_TEST_FLAG
(
g_flags
,
WORKSPACE_FLAGS_INIT
))
{
return
0
;
}
EnableInitLog
(
INIT_INFO
);
PARAM_LOGV
(
"InitParamClient"
);
int
ret
=
InitParamWorkSpace
(
1
,
NULL
);
PARAM_CHECK
(
ret
==
0
,
return
-
1
,
"Failed to init param workspace"
);
PARAM_SET_FLAG
(
g_flags
,
WORKSPACE_FLAGS_INIT
);
// init persist to save
InitPersistParamWorkSpace
();
EnableInitLog
();
return
0
;
}
...
...
services/param/liteos/param_service.c
浏览文件 @
92f4a2db
...
...
@@ -132,11 +132,11 @@ static void ParamServiceTask(int *arg)
void
LiteParamService
(
void
)
{
EnableInitLog
(
INIT_INFO
);
PARAM_LOGI
(
"LiteParamService"
);
InitParamService
();
// get persist param
LoadPersistParams
();
EnableInitLog
();
osThreadAttr_t
attr
;
attr
.
name
=
"ParamServiceTask"
;
attr
.
attr_bits
=
0U
;
...
...
test/unittest/lite/cmd_func_test.cpp
浏览文件 @
92f4a2db
...
...
@@ -124,7 +124,7 @@ public:
}
void
SetUp
()
{
EnableInitLog
();
EnableInitLog
(
INIT_FATAL
);
}
void
TearDown
()
{}
};
...
...
test/unittest/param/param_stub.cpp
浏览文件 @
92f4a2db
...
...
@@ -434,7 +434,7 @@ int TestFreeLocalSecurityLabel(ParamSecurityLabel *srcLabel)
static
__attribute__
((
constructor
(
101
)))
void
ParamTestStubInit
(
void
)
{
EnableInitLog
();
EnableInitLog
(
INIT_DEBUG
);
PARAM_LOGI
(
"ParamTestStubInit"
);
PrepareInitUnitTestEnv
();
}
...
...
ueventd/ueventd_main.c
浏览文件 @
92f4a2db
...
...
@@ -50,7 +50,7 @@ static void PollUeventdSocketTimeout(int ueventSockFd, bool ondemand)
int
main
(
int
argc
,
char
**
argv
)
{
// start log
EnableInitLog
();
EnableInitLog
(
INIT_INFO
);
char
*
ueventdConfigs
[]
=
{
"/etc/ueventd.config"
,
"/vendor/etc/ueventd.config"
,
NULL
};
int
i
=
0
;
while
(
ueventdConfigs
[
i
]
!=
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录