Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
5db71f03
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看板
提交
5db71f03
编写于
2月 13, 2023
作者:
D
dhy308
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix review issues.
Issue: I6AEEI Test: Build & Boot Devices Signed-off-by:
N
dhy308
<
tony.gan@huawei.com
>
上级
fb686cb6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
125 addition
and
10 deletion
+125
-10
libc-test/src/functionalext/common/sigchain_util.h
libc-test/src/functionalext/common/sigchain_util.h
+3
-3
libc-test/src/functionalext/sigchain/sigchain_intercept_sigaction_d.c
...c/functionalext/sigchain/sigchain_intercept_sigaction_d.c
+68
-0
libc-test/src/functionalext/sigchain/sigchain_intercept_sigprocmask_e.c
...functionalext/sigchain/sigchain_intercept_sigprocmask_e.c
+3
-3
libc-test/src/functionalext/sigchain/sigchain_intercept_sigprocmask_f.c
...functionalext/sigchain/sigchain_intercept_sigprocmask_f.c
+40
-0
libc-test/src/functionalext/sigchain/test_src_functionalext_sigchain.gni
...unctionalext/sigchain/test_src_functionalext_sigchain.gni
+2
-0
porting/linux/user/src/signal/sigprocmask.c
porting/linux/user/src/signal/sigprocmask.c
+9
-4
未找到文件。
libc-test/src/functionalext/common/sigchain_util.h
浏览文件 @
5db71f03
...
...
@@ -16,17 +16,17 @@
#define SIGCHAIN_TEST_SET_MASK(set, fun, signo, num) do{ \
int result = sigemptyset(&set); \
if (result != 0) { \
EXPECT_FALSE(fun,
(result == 0)
); \
EXPECT_FALSE(fun,
true
); \
} \
for (int i = 0; i < num; i++) { \
result = sigaddset(&set, signo[i]); \
if (result != 0) { \
EXPECT_FALSE(fun,
(result == 0)
); \
EXPECT_FALSE(fun,
true
); \
} \
} \
result = sigprocmask(SIG_BLOCK, &set, NULL); \
if (result != 0) { \
EXPECT_FALSE(fun,
(result == 0)
); \
EXPECT_FALSE(fun,
true
); \
} \
} while (0)
...
...
libc-test/src/functionalext/sigchain/sigchain_intercept_sigaction_d.c
0 → 100644
浏览文件 @
5db71f03
/*
* Copyright (c) 2023 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 <signal.h>
#include <wchar.h>
#include <stdlib.h>
#include "test.h"
#include "functionalext.h"
#include "sigchain_util.h"
/**
* @brief the special handler
*/
static
void
signal_handler1
(
int
signo
)
{
EXPECT_EQ
(
"sigchain_intercept_sigaction_001"
,
signo
,
SIGHUP
);
sigset_t
set
=
{
0
};
int
signal
[
SIGCHIAN_TEST_SIGNAL_NUM_2
]
=
{
SIGSEGV
,
SIGHUP
};
SIGCHAIN_TEST_SET_MASK
(
set
,
"sigchain_intercept_sigaction_002"
,
signal
,
SIGCHIAN_TEST_SIGNAL_NUM_2
);
raise
(
SIGSEGV
);
}
/**
* @brief the special handler
*/
static
void
signal_handler2
(
int
signo
)
{
EXPECT_EQ
(
"sigchain_intercept_sigaction_001"
,
signo
,
SIGSEGV
);
}
/**
* @tc.name : sigchain_intercept_sigaction_004
* @tc.desc : Test the influence of sigchain on sigaction, the signals are not registered with
* the special handler, and mask and rasie the signal at the special handler
* @tc.level : Level 0
*/
static
void
sigchain_intercept_sigaction_004
()
{
struct
sigaction
siga1
=
{
.
sa_handler
=
signal_handler1
,
};
sigaction
(
SIGHUP
,
&
siga1
,
NULL
);
struct
sigaction
siga2
=
{
.
sa_handler
=
signal_handler2
,
};
sigaction
(
SIGSEGV
,
&
siga2
,
NULL
);
}
int
main
(
void
)
{
sigchain_intercept_sigaction_004
();
raise
(
SIGHUP
);
return
t_status
;
}
\ No newline at end of file
libc-test/src/functionalext/sigchain/sigchain_intercept_sigprocmask_e.c
浏览文件 @
5db71f03
...
...
@@ -32,6 +32,7 @@ static bool sigchain_special_handler(int signo, siginfo_t *siginfo, void *uconte
sigset_t
set
=
{
0
};
int
signal
[
SIGCHIAN_TEST_SIGNAL_NUM_2
]
=
{
SIGHUP
,
SIGSEGV
};
SIGCHAIN_TEST_SET_MASK
(
set
,
"sigchain_intercept_sigprocmask_001"
,
signal
,
SIGCHIAN_TEST_SIGNAL_NUM_2
);
raise
(
SIGSEGV
);
g_count
++
;
}
return
false
;
...
...
@@ -43,6 +44,7 @@ static bool sigchain_special_handler(int signo, siginfo_t *siginfo, void *uconte
static
bool
sigchain_special_handler1
(
int
signo
,
siginfo_t
*
siginfo
,
void
*
ucontext_raw
)
{
EXPECT_EQ
(
"sigchain_intercept_sigprocmask_005"
,
signo
,
SIGSEGV
);
EXPECT_EQ
(
"sigchain_intercept_sigprocmask_005"
,
g_count
,
1
);
return
false
;
}
...
...
@@ -59,7 +61,7 @@ static void signal_handler(int signo)
/**
* @tc.name : sigchain_intercept_sigprocmask_005
* @tc.desc : Test the influence of sigchain on sigprocmask, the signals are registered with
* the special handler
* the special handler
, and mask and rasie the signal at the special handler
* @tc.level : Level 0
*/
static
void
sigchain_intercept_sigprocmask_005
()
...
...
@@ -97,7 +99,5 @@ int main(void)
{
sigchain_intercept_sigprocmask_005
();
raise
(
SIGHUP
);
raise
(
SIGSEGV
);
raise
(
SIGHUP
);
return
t_status
;
}
\ No newline at end of file
libc-test/src/functionalext/sigchain/sigchain_intercept_sigprocmask_f.c
0 → 100644
浏览文件 @
5db71f03
/*
* Copyright (c) 2023 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 <signal.h>
#include <wchar.h>
#include <stdlib.h>
#include "test.h"
#include "functionalext.h"
#include "sigchain_util.h"
/**
* @tc.name : sigchain_intercept_sigprocmask_006
* @tc.desc : Test the influence of sigchain on sigprocmask, the new set is null.
* @tc.level : Level 0
*/
static
void
sigchain_intercept_sigprocmask_006
()
{
int
result
=
sigprocmask
(
SIG_BLOCK
,
NULL
,
NULL
);
if
(
result
!=
0
)
{
EXPECT_FALSE
(
"sigchain_intercept_sigprocmask_006"
,
true
);
}
}
int
main
(
void
)
{
sigchain_intercept_sigprocmask_006
();
return
t_status
;
}
\ No newline at end of file
libc-test/src/functionalext/sigchain/test_src_functionalext_sigchain.gni
浏览文件 @
5db71f03
...
...
@@ -38,6 +38,7 @@ functionalext_sigchain_list = [
"sigchain_intercept_sigaction_a",
"sigchain_intercept_sigaction_b",
"sigchain_intercept_sigaction_c",
"sigchain_intercept_sigaction_d",
"sigchain_intercept_signal_a",
"sigchain_intercept_signal_b",
"sigchain_intercept_signal_c",
...
...
@@ -46,5 +47,6 @@ functionalext_sigchain_list = [
"sigchain_intercept_sigprocmask_c",
"sigchain_intercept_sigprocmask_d",
"sigchain_intercept_sigprocmask_e",
"sigchain_intercept_sigprocmask_f",
"sigchain_call_special_handler_a",
]
porting/linux/user/src/signal/sigprocmask.c
浏览文件 @
5db71f03
...
...
@@ -6,10 +6,15 @@ extern void intercept_sigprocmask(int how, sigset_t *restrict set);
int
sigprocmask
(
int
how
,
const
sigset_t
*
restrict
set
,
sigset_t
*
restrict
old
)
{
sigset_t
tmpset
=
*
set
;
intercept_sigprocmask
(
how
,
&
tmpset
);
const
sigset_t
*
new_set_ptr
=
&
tmpset
;
int
r
=
pthread_sigmask
(
how
,
new_set_ptr
,
old
);
int
r
=
0
;
if
(
set
)
{
sigset_t
tmpset
=
*
set
;
intercept_sigprocmask
(
how
,
&
tmpset
);
const
sigset_t
*
new_set_ptr
=
&
tmpset
;
r
=
pthread_sigmask
(
how
,
new_set_ptr
,
old
);
}
else
{
r
=
pthread_sigmask
(
how
,
set
,
old
);
}
if
(
!
r
)
return
r
;
errno
=
r
;
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录