Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
66a36b13
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看板
未验证
提交
66a36b13
编写于
8月 03, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 03, 2022
浏览文件
操作
浏览文件
下载
差异文件
!418 RM.010.线程stacksize根据产品配置,增加stack pageguard保护
Merge pull request !418 from dhy308/branch_rm010
上级
595e26a9
e1ddf5d3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
148 addition
and
0 deletion
+148
-0
libc-test/src/functionalext/thread/pthread_guard_size.c
libc-test/src/functionalext/thread/pthread_guard_size.c
+47
-0
libc-test/src/functionalext/thread/pthread_stack_size.c
libc-test/src/functionalext/thread/pthread_stack_size.c
+47
-0
libc-test/src/functionalext/thread/test_src_functionalext_thread.gni
...rc/functionalext/thread/test_src_functionalext_thread.gni
+2
-0
libc-test/test_template.gni
libc-test/test_template.gni
+23
-0
musl_config.gni
musl_config.gni
+6
-0
musl_template.gni
musl_template.gni
+14
-0
porting/linux/user/src/internal/pthread_impl.h
porting/linux/user/src/internal/pthread_impl.h
+9
-0
未找到文件。
libc-test/src/functionalext/thread/pthread_guard_size.c
0 → 100644
浏览文件 @
66a36b13
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <errno.h>
#include <pthread.h>
#include "pthread_util.h"
#define DEFAULT_GUARD_SIZE 8192
static
void
pthread_guard_size_0100
(
void
)
{
pthread_attr_t
attr
=
{
0
};
size_t
guard_size
=
0
;
pthread_getattr_default_np
(
&
attr
);
pthread_attr_getguardsize
(
&
attr
,
&
guard_size
);
#ifdef TARGET_GUARD_SIZE
TEST
(
guard_size
==
TARGET_GUARD_SIZE
);
#else
TEST
(
guard_size
==
DEFAULT_GUARD_SIZE
);
#endif
}
TEST_FUN
G_Fun_Array
[]
=
{
pthread_guard_size_0100
,
};
int
main
(
void
)
{
int
num
=
sizeof
(
G_Fun_Array
)
/
sizeof
(
TEST_FUN
);
for
(
int
pos
=
0
;
pos
<
num
;
++
pos
)
{
G_Fun_Array
[
pos
]();
}
return
t_status
;
}
\ No newline at end of file
libc-test/src/functionalext/thread/pthread_stack_size.c
0 → 100644
浏览文件 @
66a36b13
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <errno.h>
#include <pthread.h>
#include "pthread_util.h"
#define DEFAULT_STACK_SIZE 131072
static
void
pthread_stack_size_0100
(
void
)
{
pthread_attr_t
attr
=
{
0
};
size_t
stack_size
=
0
;
pthread_getattr_default_np
(
&
attr
);
pthread_attr_getstacksize
(
&
attr
,
&
stack_size
);
#ifdef TARGET_STACK_SIZE
TEST
(
stack_size
==
TARGET_STACK_SIZE
);
#else
TEST
(
stack_size
==
DEFAULT_STACK_SIZE
);
#endif
}
TEST_FUN
G_Fun_Array
[]
=
{
pthread_stack_size_0100
,
};
int
main
(
void
)
{
int
num
=
sizeof
(
G_Fun_Array
)
/
sizeof
(
TEST_FUN
);
for
(
int
pos
=
0
;
pos
<
num
;
++
pos
)
{
G_Fun_Array
[
pos
]();
}
return
t_status
;
}
\ No newline at end of file
libc-test/src/functionalext/thread/test_src_functionalext_thread.gni
浏览文件 @
66a36b13
...
...
@@ -15,4 +15,6 @@ functionalext_thread_list = [
"pthread_mutex",
"pthread_rwlock_rdlock",
"pthread_rwlock_wrlock",
"pthread_guard_size",
"pthread_stack_size",
]
libc-test/test_template.gni
浏览文件 @
66a36b13
import("//build/test.gni")
import("//third_party/musl/musl_config.gni")
musl_base_dir = "third_party/musl/"
test_dir = "${musl_base_dir}/libc-test"
...
...
@@ -176,6 +177,28 @@ template("test_unittest") {
ldflags += [ "-Wl,-rpath=./" ]
}
}
if (target_dir == "functionalext/thread") {
if (!defined(defines)) {
defines = []
}
if (musl_target_os == "linux" && product_path != "" &&
product_path != rebase_path("//productdefine/common/products")) {
_product_config = read_file("${product_path}/config.json", "json")
if (target_name == "pthread_stack_size") {
if (defined(_product_config.device_stack_size)) {
defines +=
[ "TARGET_STACK_SIZE=${_product_config.device_stack_size}" ]
}
}
if (target_name == "pthread_guard_size") {
if (defined(_product_config.device_guard_size)) {
defines +=
[ "TARGET_GUARD_SIZE=${_product_config.device_guard_size}" ]
}
}
}
}
}
}
...
...
musl_config.gni
浏览文件 @
66a36b13
...
...
@@ -56,3 +56,9 @@ declare_args() {
enable_musl_log = false
musl_secure_level = 1
}
declare_args() {
if (!defined(product_path)) {
product_path = ""
}
}
musl_template.gni
浏览文件 @
66a36b13
...
...
@@ -389,6 +389,20 @@ template("musl_libs") {
configs -= musl_inherited_configs
configs += [ ":${abi_prefix}_musl_config" ]
if (!defined(defines)) {
defines = []
}
if (musl_target_os == "linux" && product_path != "" &&
product_path != rebase_path("//productdefine/common/products")) {
_product_config = read_file("${product_path}/config.json", "json")
if (defined(_product_config.device_stack_size)) {
defines += [ "TARGET_STACK_SIZE=${_product_config.device_stack_size}" ]
}
if (defined(_product_config.device_guard_size)) {
defines += [ "TARGET_GUARD_SIZE=${_product_config.device_guard_size}" ]
}
}
deps = porting_deps
}
...
...
porting/linux/user/src/internal/pthread_impl.h
浏览文件 @
66a36b13
...
...
@@ -242,8 +242,17 @@ extern hidden volatile int __thread_list_lock;
extern
hidden
unsigned
__default_stacksize
;
extern
hidden
unsigned
__default_guardsize
;
#ifdef TARGET_STACK_SIZE
#define DEFAULT_STACK_SIZE TARGET_STACK_SIZE
#else
#define DEFAULT_STACK_SIZE 131072
#endif
#ifdef TARGET_GUARD_SIZE
#define DEFAULT_GUARD_SIZE TARGET_GUARD_SIZE
#else
#define DEFAULT_GUARD_SIZE 8192
#endif
#define DEFAULT_STACK_MAX (8<<20)
#define DEFAULT_GUARD_MAX (1<<20)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录