fix: add syscall for ppoll & add 2 testcases
1.modifications: modified: syscall/los_syscall.h modified: syscall/misc_syscall.c modified: syscall/syscall_lookup.h 2.add 3 testcases: testsuites/unittest/IO/full/IO_test_ppoll_001.cpp testsuites/unittest/IO/full/IO_test_ppoll_002.cpp 3.influence: none Signed-off-by: teamol <28105285@qq.com>
This commit is contained in:
@@ -2435,4 +2435,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
|
||||
|
||||
@@ -275,6 +275,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);
|
||||
|
||||
@@ -85,6 +85,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)
|
||||
@@ -258,4 +259,4 @@ SYSCALL_HAND_DEF(__NR_creat_user_thread, SysCreateUserThread, unsigned int, ARG_
|
||||
SYSCALL_HAND_DEF(__NR_getrusage, SysGetrusage, int, ARG_NUM_2)
|
||||
SYSCALL_HAND_DEF(__NR_sysconf, SysSysconf, long, ARG_NUM_1)
|
||||
SYSCALL_HAND_DEF(__NR_ugetrlimit, SysUgetrlimit, int, ARG_NUM_2)
|
||||
SYSCALL_HAND_DEF(__NR_setrlimit, SysSetrlimit, int, ARG_NUM_2)
|
||||
SYSCALL_HAND_DEF(__NR_setrlimit, SysSetrlimit, int, ARG_NUM_2)
|
||||
|
||||
Reference in New Issue
Block a user