Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
7cb2ad67
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
9 个月 前同步成功
通知
450
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7cb2ad67
编写于
8月 30, 2021
作者:
O
openharmony_ci
提交者:
Gitee
8月 30, 2021
浏览文件
操作
浏览文件
下载
差异文件
!570 fix ppoll & add 2 testcases
Merge pull request !570 from guweijie/gwj-kernel-ppoll-20210825
上级
aa5b2c76
defedb6f
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
70 addition
and
7 deletion
+70
-7
syscall/fs_syscall.c
syscall/fs_syscall.c
+35
-0
syscall/los_syscall.h
syscall/los_syscall.h
+2
-0
syscall/syscall_lookup.h
syscall/syscall_lookup.h
+1
-0
testsuites/unittest/IO/BUILD.gn
testsuites/unittest/IO/BUILD.gn
+2
-0
testsuites/unittest/IO/It_test_IO.h
testsuites/unittest/IO/It_test_IO.h
+2
-1
testsuites/unittest/IO/full/IO_test_ppoll_001.cpp
testsuites/unittest/IO/full/IO_test_ppoll_001.cpp
+6
-6
testsuites/unittest/IO/io_test.cpp
testsuites/unittest/IO/io_test.cpp
+22
-0
未找到文件。
syscall/fs_syscall.c
浏览文件 @
7cb2ad67
...
...
@@ -2459,4 +2459,39 @@ int SysFstatfs64(int fd, size_t sz, struct statfs *buf)
return
ret
;
}
int
SysPpoll
(
struct
pollfd
*
fds
,
nfds_t
nfds
,
const
struct
timespec
*
tmo_p
,
const
sigset_t
*
sigMask
,
int
nsig
)
{
int
timeout
;
int
ret
;
sigset_t_l
origMask
;
sigset_t_l
setl
;
if
(
sigMask
==
NULL
)
{
ret
=
-
EINVAL
;
return
ret
;
}
CHECK_ASPACE
(
tmo_p
,
sizeof
(
struct
timespec
));
CHECK_ASPACE
(
sigMask
,
sizeof
(
sigset_t
));
CPY_FROM_USER
(
tmo_p
);
CPY_FROM_USER
(
sigMask
);
timeout
=
(
tmo_p
==
NULL
)
?
-
1
:
(
tmo_p
->
tv_sec
*
OS_SYS_US_PER_MS
+
tmo_p
->
tv_nsec
/
OS_SYS_NS_PER_MS
);
if
(
timeout
&
0x80000000
)
{
ret
=
-
EINVAL
;
return
ret
;
}
setl
.
sig
[
0
]
=
*
sigMask
;
OsSigprocMask
(
SIG_SETMASK
,
&
setl
,
&
origMask
);
ret
=
SysPoll
(
fds
,
nfds
,
timeout
);
if
(
ret
<
0
)
{
ret
=
-
get_errno
();
}
OsSigprocMask
(
SIG_SETMASK
,
&
origMask
,
NULL
);
PointerFree
(
tmo_pbak
);
PointerFree
(
sigMaskbak
);
return
(
ret
==
-
1
)
?
-
get_errno
()
:
ret
;
}
#endif
syscall/los_syscall.h
浏览文件 @
7cb2ad67
...
...
@@ -277,6 +277,8 @@ extern int SysFstat64(int fd, struct stat64 *buf);
extern
int
SysFstatat64
(
int
fd
,
const
char
*
restrict
path
,
struct
stat
*
restrict
buf
,
int
flag
);
extern
int
SysFcntl64
(
int
fd
,
int
cmd
,
void
*
arg
);
extern
int
SysPoll
(
struct
pollfd
*
fds
,
nfds_t
nfds
,
int
timeout
);
extern
int
SysPpoll
(
struct
pollfd
*
fds
,
nfds_t
nfds
,
const
struct
timespec
*
tmo_p
,
const
sigset_t
*
sigmask
,
int
nsig
);
extern
int
SysPrctl
(
int
option
,
...);
extern
ssize_t
SysPread64
(
int
fd
,
void
*
buf
,
size_t
nbytes
,
off64_t
offset
);
extern
ssize_t
SysPwrite64
(
int
fd
,
const
void
*
buf
,
size_t
nbytes
,
off64_t
offset
);
...
...
syscall/syscall_lookup.h
浏览文件 @
7cb2ad67
...
...
@@ -86,6 +86,7 @@ SYSCALL_HAND_DEF(__NR__newselect, SysSelect, int, ARG_NUM_5)
SYSCALL_HAND_DEF
(
__NR_readv
,
SysReadv
,
ssize_t
,
ARG_NUM_3
)
SYSCALL_HAND_DEF
(
__NR_writev
,
SysWritev
,
ssize_t
,
ARG_NUM_3
)
SYSCALL_HAND_DEF
(
__NR_poll
,
SysPoll
,
int
,
ARG_NUM_3
)
SYSCALL_HAND_DEF
(
__NR_ppoll
,
SysPpoll
,
int
,
ARG_NUM_5
)
SYSCALL_HAND_DEF
(
__NR_prctl
,
SysPrctl
,
int
,
ARG_NUM_7
)
SYSCALL_HAND_DEF
(
__NR_pread64
,
SysPread64
,
ssize_t
,
ARG_NUM_7
)
SYSCALL_HAND_DEF
(
__NR_pwrite64
,
SysPwrite64
,
ssize_t
,
ARG_NUM_7
)
...
...
testsuites/unittest/IO/BUILD.gn
浏览文件 @
7cb2ad67
...
...
@@ -83,6 +83,8 @@ sources_full = [
"full/IO_test_gettext_001.cpp",
"full/IO_test_strncasecmp_l_001.cpp",
"full/IO_test_strncasecmp_l_002.cpp",
"full/IO_test_ppoll_001.cpp",
"full/IO_test_ppoll_002.cpp",
]
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
...
...
testsuites/unittest/IO/It_test_IO.h
浏览文件 @
7cb2ad67
...
...
@@ -132,6 +132,7 @@ extern VOID IO_TEST_PPOLL_002(void);
extern
VOID
IO_TEST_PSELECT_001
(
void
);
extern
VOID
IO_TEST_STRFMON_L_001
(
VOID
);
extern
VOID
IO_TEST_STRFMON_L_002
(
VOID
);
extern
VOID
IO_TEST_PPOLL_001
(
VOID
);
extern
VOID
IO_TEST_PPOLL_002
(
VOID
);
#endif
testsuites/unittest/IO/full/IO_test_ppoll_001.cpp
浏览文件 @
7cb2ad67
...
...
@@ -47,16 +47,16 @@ static void *pthread_01(void)
int
total_num
=
0
;
int
times
=
3
;
int
i
,
ret
;
struct
pollfd
fds
[
LISTEN_FD_NUM
]
=
{
0
};
struct
pollfd
fds
[
LISTEN_FD_NUM
]
=
{
0
};
char
buffer
[
20
];
struct
timespec
t
=
{
3
,
0
};
sigset_t
sigset
;
TEST_PRINT
(
"[INFO]%s:%d,%s,Create thread %d
\n
"
,
__FILE__
,
__LINE__
,
__func__
,
count
);
/* TEST_PRINT("[INFO]%s:%d,%s,Create thread %d\n", __FILE__, __LINE__, __func__, count); */
count
++
;
sigemptyset
(
&
sigset
);
sigaddset
(
&
sigset
,
SIGALRM
);
/
/把SIGALRM 信号添加到sigset 信号集中
sigaddset
(
&
sigset
,
SIGALRM
);
/
* 把SIGALRM 信号添加到sigset 信号集中 */
sigaddset
(
&
sigset
,
SIGUSR1
);
for
(
i
=
0
;
i
<
LISTEN_FD_NUM
;
i
++
)
{
...
...
@@ -87,7 +87,7 @@ static void *pthread_01(void)
}
/* ICUNIT_GOTO_EQUAL(total_num, 10, -1, EXIT); */
TEST_PRINT
(
"[INFO]%s:%d,%s,total_num=%d
\n
"
,
__FILE__
,
__LINE__
,
__func__
,
total_num
);
/* TEST_PRINT("[INFO]%s:%d,%s,total_num=%d\n", __FILE__, __LINE__, __func__, total_num); */
EXIT:
return
nullptr
;
}
...
...
@@ -106,7 +106,7 @@ static UINT32 testcase1(VOID)
}
errno
=
0
;
ret
=
pthread_create
(
&
g_tid
,
nullptr
,
pthread_01
(
nullptr
)
,
nullptr
);
ret
=
pthread_create
(
&
g_tid
,
nullptr
,
(
void
*
(
*
)(
void
*
))
pthread_01
,
nullptr
);
TEST_PRINT
(
"[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s
\n
"
,
__FILE__
,
__LINE__
,
__func__
,
ret
,
errno
,
strerror
(
errno
));
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
...
...
@@ -127,7 +127,7 @@ static UINT32 testcase1(VOID)
sleep
(
1
);
for
(
i
=
0
;
i
<
LISTEN_FD_NUM
;
i
++
)
{
errno
=
0
;
ret
=
pthread_create
(
&
g_tid
,
nullptr
,
pthread_01
(
nullptr
)
,
nullptr
);
ret
=
pthread_create
(
&
g_tid
,
nullptr
,
(
void
*
(
*
)(
void
*
))
pthread_01
,
nullptr
);
TEST_PRINT
(
"[INFO]%s:%d,%s,ret=%d,errno=%d,errstr=%s
\n
"
,
__FILE__
,
__LINE__
,
__func__
,
ret
,
errno
,
strerror
(
errno
));
ICUNIT_GOTO_EQUAL
(
ret
,
0
,
ret
,
EXIT
);
...
...
testsuites/unittest/IO/io_test.cpp
浏览文件 @
7cb2ad67
...
...
@@ -93,6 +93,28 @@ HWTEST_F(IoTest, ItTestIo013, TestSize.Level0)
#endif
#if defined(LOSCFG_USER_TEST_FULL)
/* *
* @tc.name: IO_TEST_PPOLL_001
* @tc.desc: function for IoTest
* @tc.type: FUNC
* @tc.require: AR000EEMQ9
*/
HWTEST_F
(
IoTest
,
IO_TEST_PPOLL_001
,
TestSize
.
Level0
)
{
IO_TEST_PPOLL_001
();
}
/* *
* @tc.name: IO_TEST_PPOLL_002
* @tc.desc: function for IoTest
* @tc.type: FUNC
* @tc.require: AR000EEMQ9
*/
HWTEST_F
(
IoTest
,
IO_TEST_PPOLL_002
,
TestSize
.
Level0
)
{
IO_TEST_PPOLL_002
();
}
/* *
* @tc.name: IT_STDLIB_POLL_002
* @tc.desc: function for IoTest
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录