Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
23942087
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看板
未验证
提交
23942087
编写于
7月 04, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 04, 2023
浏览文件
操作
浏览文件
下载
差异文件
!964 添加jemalloc垃圾回收信号
Merge pull request !964 from 李策/master
上级
4e2cc2bd
9b010e1f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
0 deletion
+35
-0
musl_config.gni
musl_config.gni
+1
-0
musl_template.gni
musl_template.gni
+6
-0
porting/linux/user/include/signal.h
porting/linux/user/include/signal.h
+3
-0
porting/linux/user/src/hook/musl_preinit.c
porting/linux/user/src/hook/musl_preinit.c
+25
-0
未找到文件。
musl_config.gni
浏览文件 @
23942087
...
@@ -36,6 +36,7 @@ declare_args() {
...
@@ -36,6 +36,7 @@ declare_args() {
user_custom_libc = true
user_custom_libc = true
use_jemalloc = false
use_jemalloc = false
use_jemalloc_dfx_intf = false
use_jemalloc_dfx_intf = false
use_jemalloc_recycle_func = false
use_pthread_cancel = false
use_pthread_cancel = false
musl_ported_dir = "intermidiates/${musl_target_os}/musl_src_ported"
musl_ported_dir = "intermidiates/${musl_target_os}/musl_src_ported"
musl_inc_out_dir = "usr/include/${musl_target_triple}"
musl_inc_out_dir = "usr/include/${musl_target_triple}"
...
...
musl_template.gni
浏览文件 @
23942087
...
@@ -584,6 +584,9 @@ template("musl_libs") {
...
@@ -584,6 +584,9 @@ template("musl_libs") {
if (use_jemalloc_dfx_intf) {
if (use_jemalloc_dfx_intf) {
defines += [ "USE_JEMALLOC_DFX_INTF" ]
defines += [ "USE_JEMALLOC_DFX_INTF" ]
}
}
if (use_jemalloc_recycle_func) {
defines += [ "USE_JEMALLOC_RECYCLE_FUNC" ]
}
include_dirs = [ "//third_party/jemalloc/include/jemalloc" ]
include_dirs = [ "//third_party/jemalloc/include/jemalloc" ]
}
}
...
@@ -797,6 +800,9 @@ template("musl_libs") {
...
@@ -797,6 +800,9 @@ template("musl_libs") {
if (use_jemalloc_dfx_intf) {
if (use_jemalloc_dfx_intf) {
defines += [ "USE_JEMALLOC_DFX_INTF" ]
defines += [ "USE_JEMALLOC_DFX_INTF" ]
}
}
if (use_jemalloc_recycle_func) {
defines += [ "USE_JEMALLOC_RECYCLE_FUNC" ]
}
include_dirs = [ "//third_party/jemalloc/include/jemalloc" ]
include_dirs = [ "//third_party/jemalloc/include/jemalloc" ]
}
}
...
...
porting/linux/user/include/signal.h
浏览文件 @
23942087
...
@@ -217,6 +217,9 @@ int __libc_current_sigrtmax(void);
...
@@ -217,6 +217,9 @@ int __libc_current_sigrtmax(void);
#define MUSL_SIGNAL_NATIVE_LOCAL (SIGRTMIN + 3)
#define MUSL_SIGNAL_NATIVE_LOCAL (SIGRTMIN + 3)
#define MUSL_SIGNAL_JSHEAP (SIGRTMIN + 4)
#define MUSL_SIGNAL_JSHEAP (SIGRTMIN + 4)
#define MUSL_SIGNAL_JSHEAP_PRIV (SIGRTMIN + 5)
#define MUSL_SIGNAL_JSHEAP_PRIV (SIGRTMIN + 5)
#ifdef USE_JEMALLOC_RECYCLE_FUNC
#define MUSL_SIGNAL_RECYCLE_JEMALLOC(SIGRTMIN + 8)
#endif
#define MUSL_SIGNAL_MEMCHECK (SIGRTMIN + 9)
#define MUSL_SIGNAL_MEMCHECK (SIGRTMIN + 9)
int
kill
(
pid_t
,
int
);
int
kill
(
pid_t
,
int
);
...
...
porting/linux/user/src/hook/musl_preinit.c
浏览文件 @
23942087
...
@@ -271,6 +271,28 @@ static bool init_prctl_function(void* malloc_shared_library_handler, MallocPrctl
...
@@ -271,6 +271,28 @@ static bool init_prctl_function(void* malloc_shared_library_handler, MallocPrctl
return
true
;
return
true
;
}
}
#ifdef USE_JEMALLOC_RECYCLE_FUNC
extern
int
je_reclaim_cache
();
static
void
handle_recycle_cache
()
{
int
ret
;
ret
=
je_reclaim_cache
();
MUSL_LOGD
(
"je_reclaim_cache result=%{public}d"
,
ret
);
}
static
void
init_jemalloc_recycle_handler
()
{
struct
sigaction
action
=
{};
action
.
sa_handler
=
NULL
;
action
.
sa_sigaction
=
handle_recycle_cache
;
sigemptyset
(
&
action
.
sa_mask
);
sigaddset
(
&
action
.
sa_mask
,
MUSL_SIGNAL_RECYCLE_JEMALLOC
);
action
.
sa_flags
=
SA_SIGINFO
|
SA_RESTART
;
action
.
sa_restorer
=
NULL
;
sigaction
(
MUSL_SIGNAL_RECYCLE_JEMALLOC
,
&
action
,
NULL
);
}
#endif
static
bool
init_hook_functions
(
void
*
shared_library_handler
,
struct
MallocDispatchType
*
table
,
const
char
*
prefix
)
static
bool
init_hook_functions
(
void
*
shared_library_handler
,
struct
MallocDispatchType
*
table
,
const
char
*
prefix
)
{
{
...
@@ -626,6 +648,9 @@ static void __install_malloc_hook_signal_handler()
...
@@ -626,6 +648,9 @@ static void __install_malloc_hook_signal_handler()
static
void
__initialize_malloc
()
static
void
__initialize_malloc
()
{
{
__install_malloc_hook_signal_handler
();
__install_malloc_hook_signal_handler
();
#ifdef USE_JEMALLOC_RECYCLE_FUNC
init_jemalloc_recycle_handler
();
#endif
}
}
__attribute__
((
constructor
(
1
)))
static
void
__musl_initialize
()
__attribute__
((
constructor
(
1
)))
static
void
__musl_initialize
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录