@@ -2115,6 +2115,40 @@ out:
return ret;
}
+SYSCALL_DEFINE6(epoll_pwait1, int, epfd, int, flags,
+ struct epoll_event __user *, events,
+ int, maxevents, struct timespec __user *, timeout,
+ void __user *, sig)
+{
+ size_t sigsetsize = 0;
+ sigset_t ksigmask;
+ sigset_t __user *sigmask = NULL;
+ struct timespec kts;
+ ktime_t kt = { 0 };
+
+ if (flags)
+ return -EINVAL;
+ if (sig) {
+ if (!access_ok(VERIFY_READ, sig, sizeof(void *)+sizeof(size_t))
+ || __get_user(sigmask, (sigset_t __user * __user *)sig)
+ || __get_user(sigsetsize,
+ (size_t __user *)(sig+sizeof(void *))))
+ return -EFAULT;
+ if (sigsetsize != sizeof(sigset_t))
+ return -EINVAL;
+ if (copy_from_user(&ksigmask, sigmask, sizeof(ksigmask)))
+ return -EFAULT;
+ }
+ if (timeout) {
+ if (copy_from_user(&kts, timeout, sizeof(kts)))
+ return -EFAULT;
+ kt = timespec_to_ktime(kts);
+ }
+
+ return epoll_pwait_do(epfd, events, maxevents, CLOCK_MONOTONIC,
+ kt, &ksigmask);
+}
+
#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd,
struct epoll_event __user *, events,
@@ -631,6 +631,11 @@ asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events,
int maxevents, int timeout,
const sigset_t __user *sigmask,
size_t sigsetsize);
+asmlinkage long sys_epoll_pwait1(int epfd, int flags,
+ struct epoll_event __user *events,
+ int maxevents,
+ struct timespec __user *timeout,
+ void __user *sig);
asmlinkage long sys_epoll_ctl_batch(int epfd, int flags,
int ncmds,
struct epoll_ctl_cmd __user *cmds);
This is the new implementation for poll which uses timespec as timeout, and has a flags parameter. Signed-off-by: Fam Zheng <famz@redhat.com> --- fs/eventpoll.c | 34 ++++++++++++++++++++++++++++++++++ include/linux/syscalls.h | 5 +++++ 2 files changed, 39 insertions(+)