Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
49c38808
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
1 年多 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
49c38808
编写于
1月 11, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 11, 2023
浏览文件
操作
浏览文件
下载
差异文件
!774 Replace SystemReadParam with CachedParameterGet
Merge pull request !774 from maweiye/update-param
上级
3c9db3b9
839e18ac
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
50 deletion
+37
-50
porting/linux/user/ldso/ld_log.c
porting/linux/user/ldso/ld_log.c
+9
-37
porting/linux/user/src/hilog/hilog_adapter.c
porting/linux/user/src/hilog/hilog_adapter.c
+17
-9
porting/linux/user/src/internal/hilog_adapter.h
porting/linux/user/src/internal/hilog_adapter.h
+5
-0
porting/linux/user/src/time/__tz.c
porting/linux/user/src/time/__tz.c
+6
-4
未找到文件。
porting/linux/user/ldso/ld_log.c
浏览文件 @
49c38808
...
...
@@ -53,40 +53,26 @@ static char *get_app_name(char *buf, size_t length)
return
app
;
}
static
bool
get_ld_log_
app_value
(
char
*
buffer
,
uint32_t
*
length
)
static
bool
get_ld_log_
value
(
)
{
char
buf
[
PROCESS_NAME_LEN
];
char
*
path
=
get_app_name
(
buf
,
PROCESS_NAME_LEN
);
if
(
!
path
)
{
buffer
[
0
]
=
0
;
return
false
;
}
char
app_param_name
[
PROCESS_NAME_LEN
]
=
"musl.log.ld.app."
;
strcat
(
app_param_name
,
path
);
if
(
SystemReadParam
(
app_param_name
,
buffer
,
length
)
==
0
)
{
buffer
[
*
length
]
=
0
;
return
true
;
static
CachedHandle
app_param_handle
=
NULL
;
static
CachedHandle
all_param_handle
=
NULL
;
if
(
app_param_handle
==
NULL
)
{
app_param_handle
=
CachedParameterCreate
(
app_param_name
,
"false"
);
}
buffer
[
0
]
=
0
;
return
false
;
}
static
bool
get_ld_log_all_value
(
char
*
buffer
,
uint32_t
*
length
)
{
if
(
SystemReadParam
(
"musl.log.ld.all"
,
buffer
,
length
)
==
0
)
{
buffer
[
*
length
]
=
0
;
return
true
;
if
(
all_param_handle
==
NULL
)
{
all_param_handle
=
CachedParameterCreate
(
"musl.log.ld.all"
,
"false"
);
}
buffer
[
0
]
=
0
;
return
false
;
}
static
inline
void
assign_ld_log_enable
(
char
*
param_value
,
const
char
*
expect_value
)
{
ld_log_enable
=
(
strcmp
(
param_value
,
expect_value
)
==
0
);
return
(
get_bool_sysparam
(
app_param_handle
)
||
get_bool_sysparam
(
all_param_handle
));
}
#endif
void
ld_log_reset
()
...
...
@@ -96,21 +82,7 @@ void ld_log_reset()
ld_log_enable
=
false
;
return
;
}
char
app_param_value
[
SYSPARAM_LENGTH
];
uint32_t
app_param_value_len
=
SYSPARAM_LENGTH
;
char
all_param_value
[
SYSPARAM_LENGTH
];
uint32_t
all_param_value_len
=
SYSPARAM_LENGTH
;
if
(
get_ld_log_app_value
(
app_param_value
,
&
app_param_value_len
))
{
assign_ld_log_enable
(
app_param_value
,
"true"
);
}
else
{
if
(
get_ld_log_all_value
(
all_param_value
,
&
all_param_value_len
))
{
assign_ld_log_enable
(
all_param_value
,
"true"
);
}
else
{
ld_log_enable
=
false
;
}
}
ld_log_enable
=
get_ld_log_value
();
#else
ld_log_enable
=
is_musl_log_enable
();
#endif
...
...
porting/linux/user/src/hilog/hilog_adapter.c
浏览文件 @
49c38808
...
...
@@ -148,19 +148,27 @@ bool HiLogAdapterIsLoggable(unsigned int domain, const char *tag, LogLevel level
return
true
;
}
void
musl_log_reset
()
#ifdef OHOS_ENABLE_PARAMETER
bool
get_bool_sysparam
(
CachedHandle
cachedhandle
)
{
#if (defined(OHOS_ENABLE_PARAMETER))
char
param_value
[
SYSPARAM_LENGTH
];
uint32_t
length
=
SYSPARAM_LENGTH
;
if
(
SystemReadParam
(
param_name
,
param_value
,
&
length
)
==
0
)
{
param_value
[
length
]
=
0
;
char
*
param_value
=
CachedParameterGet
(
cachedhandle
);
if
(
param_value
!=
NULL
)
{
if
(
strcmp
(
param_value
,
"true"
)
==
0
)
{
musl_log_enable
=
true
;
return
;
return
true
;
}
}
musl_log_enable
=
false
;
return
false
;
}
#endif
void
musl_log_reset
()
{
#if (defined(OHOS_ENABLE_PARAMETER))
static
CachedHandle
musl_log_Handle
=
NULL
;
if
(
musl_log_Handle
==
NULL
)
{
musl_log_Handle
=
CachedParameterCreate
(
param_name
,
"false"
);
}
musl_log_enable
=
get_bool_sysparam
(
musl_log_Handle
);
#elif (defined(ENABLE_MUSL_LOG))
musl_log_enable
=
true
;
#endif
...
...
porting/linux/user/src/internal/hilog_adapter.h
浏览文件 @
49c38808
...
...
@@ -50,6 +50,11 @@ hidden int HiLogAdapterPrint(LogType type, LogLevel level, unsigned int domain,
hidden
bool
HiLogAdapterIsLoggable
(
unsigned
int
domain
,
const
char
*
tag
,
LogLevel
level
);
#ifdef OHOS_ENABLE_PARAMETER
#include "sys_param.h"
hidden
bool
get_bool_sysparam
(
CachedHandle
cachedhandle
);
#endif
hidden
bool
is_musl_log_enable
();
hidden
void
musl_log_reset
();
...
...
porting/linux/user/src/time/__tz.c
浏览文件 @
49c38808
...
...
@@ -157,10 +157,12 @@ static void do_tzset()
s
=
getenv
(
"TZ"
);
if
(
!
s
)
{
#ifdef OHOS_ENABLE_PARAMETER
uint32_t
tz_param_value_len
=
SYSPARAM_LENGTH
;
char
tz_param_value
[
SYSPARAM_LENGTH
+
1
]
=
{
0
};
if
(
SystemReadParam
(
"persist.time.timezone"
,
tz_param_value
,
&
tz_param_value_len
)
==
0
)
{
tz_param_value
[
tz_param_value_len
]
=
0
;
static
CachedHandle
tz_param_handle
=
NULL
;
if
(
tz_param_handle
==
NULL
)
{
tz_param_handle
=
CachedParameterCreate
(
"persist.time.timezone"
,
"/etc/localtime"
);
}
const
char
*
tz_param_value
=
CachedParameterGet
(
tz_param_handle
);
if
(
tz_param_value
!=
NULL
){
s
=
tz_param_value
;
}
else
{
s
=
"/etc/localtime"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录