From owner-dev-commits-src-all@freebsd.org Mon Jun 21 16:34:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB7F764B94D; Mon, 21 Jun 2021 16:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7w8w4JK1z3vwY; Mon, 21 Jun 2021 16:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BFFD20896; Mon, 21 Jun 2021 16:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15LGYOQW032756; Mon, 21 Jun 2021 16:34:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15LGYODJ032755; Mon, 21 Jun 2021 16:34:24 GMT (envelope-from git) Date: Mon, 21 Jun 2021 16:34:24 GMT Message-Id: <202106211634.15LGYODJ032755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 2eff670fde51 - main - linux(4): Implement poll system call via linux_common_ppol() for the sake of converting events to/from native. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2eff670fde51762239fc64139b0cfb5272ce9cdd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2021 16:34:24 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=2eff670fde51762239fc64139b0cfb5272ce9cdd commit 2eff670fde51762239fc64139b0cfb5272ce9cdd Author: Dmitry Chagin AuthorDate: 2021-06-22 05:07:46 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-22 05:07:46 +0000 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