From 2eff670fde51762239fc64139b0cfb5272ce9cdd Mon Sep 17 00:00:00 2001 From: Dmitry Chagin Date: Tue, 22 Jun 2021 08:07:46 +0300 Subject: linux(4): Implement poll system call via linux_common_ppol() for the sake of converting events to/from native. MFC after: 2 weeks --- sys/amd64/linux/syscalls.master | 4 ++-- sys/amd64/linux32/syscalls.master | 4 ++-- sys/arm/linux/syscalls.master | 4 ++-- sys/compat/linux/linux_misc.c | 20 ++++++++++++++++++++ sys/i386/linux/syscalls.master | 4 ++-- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master index 0cac26337ef1..4762a2ccc6a5 100644 --- a/sys/amd64/linux/syscalls.master +++ b/sys/amd64/linux/syscalls.master @@ -82,8 +82,8 @@ struct l_newstat *buf ); } -7 AUE_POLL NOPROTO { - int poll( +7 AUE_POLL STD { + int linux_poll( struct pollfd *fds, u_int nfds, int timeout diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 0ca919182998..be6c150eebfa 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -887,8 +887,8 @@ } 166 AUE_NULL UNIMPL vm86 167 AUE_NULL UNIMPL query_module -168 AUE_POLL NOPROTO { - int poll( +168 AUE_POLL STD { + int linux_poll( struct pollfd *fds, unsigned int nfds, int timeout diff --git a/sys/arm/linux/syscalls.master b/sys/arm/linux/syscalls.master index 42adc18bbe1e..46cf988c3dfe 100644 --- a/sys/arm/linux/syscalls.master +++ b/sys/arm/linux/syscalls.master @@ -744,8 +744,8 @@ } 166 AUE_NULL UNIMPL ; was linux_vm86 167 AUE_NULL UNIMPL ; was linux_query_module -168 AUE_POLL NOPROTO { - int poll( +168 AUE_POLL STD { + int linux_poll( struct pollfd* fds, unsigned int nfds, long timeout diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 80458364017f..1c1a8952bd79 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -2858,3 +2858,23 @@ linux_getcpu(struct thread *td, struct linux_getcpu_args *args) error = copyout(&node, args->node, sizeof(l_int)); return (error); } + +#if defined(__i386__) || defined(__amd64__) +int +linux_poll(struct thread *td, struct linux_poll_args *args) +{ + struct timespec ts, *tsp; + + if (args->timeout != INFTIM) { + if (args->timeout < 0) + return (EINVAL); + ts.tv_sec = args->timeout / 1000; + ts.tv_nsec = (args->timeout % 1000) * 1000000; + tsp = &ts; + } else + tsp = NULL; + + return (linux_common_ppoll(td, args->fds, args->nfds, + tsp, NULL, 0)); +} +#endif /* __i386__ || __amd64__ */ diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index f75b1253bc14..acbe5628e7ce 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -912,8 +912,8 @@ int linux_vm86(void); } 167 AUE_NULL UNIMPL query_module -168 AUE_POLL NOPROTO { - int poll( +168 AUE_POLL STD { + int linux_poll( struct pollfd *fds, unsigned int nfds, long timeout -- cgit v1.2.3