From nobody Fri Jun 17 19:39:25 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2010285BF75; Fri, 17 Jun 2022 19:39:26 +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 4LPq9n4WDMz3Qxw; Fri, 17 Jun 2022 19:39:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NUle1dUFSIBfSnTMTEbNbECpli3zZVy1xfaN1klkNuM=; b=hy3WLuJEMZm0OywMTmWIk6Osd+8PV563RonHVxHQ+OwqEZixNVWdXtQNLUFiRLmeiJ69tI ehJFphDq/hTqgepsBFutqzXdHV1mr1nLjaw3ySVfz+cw99R4hDP1Uyh/G6XVyKLL2KCqgo bZGBeTciBo8dXQxGMbziHB6napuNsOU5vNE6NV2pYcxF0mFu90w7gUGLOD1HDR5a+h/ZZb 8ita+DCrOwlOH8G+c/6NYB0sGODB3vlqMaRJD83rju07BDD7Z05MgXFjRJ7NY9VIH/ZgrN aDXSkhIaDe8JmWk6Zs4AFvS9J7nTPMXDqKCSMoWkYaLM/F92QHO2w8XWQ2T4Pw== 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 5E70E25AD7; Fri, 17 Jun 2022 19:39:25 +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 25HJdP99015985; Fri, 17 Jun 2022 19:39:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJdPmG015984; Fri, 17 Jun 2022 19:39:25 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:39:25 GMT Message-Id: <202206171939.25HJdPmG015984@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 2d05c4f018fa - stable/13 - linux(4): Add linux_epoll_pwait_ts() helper for future use. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2d05c4f018fa4514c3ee5391802ce9eadcc5e140 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NUle1dUFSIBfSnTMTEbNbECpli3zZVy1xfaN1klkNuM=; b=rZn5gKGvqzXEPfPNCo9ILaAM436ONhwZ4DcARGY7HE9WrzRVSm9Va0hNaiWNBOw1XiFdab ueGHcZzGVlCYPbQP9EaZDEuEDR3l0iAn8R+w7nNmnHjqFRPSgZmRbLzPE4akmg6AzGhxD3 j8ixGzwGodt0PN12DvoMsnqLsy4eXHQGVN3zYGRm7cLW0vWQaZfhX9/b2KEPgqvpq+Ah6G ljV+3/XeupuAW9ZW/eSEFGGLN3/wTZcc2DiPYz3h23OEUWAPfz3Qzz7PwoPludkDUxuVPC 3k1kiBu1GfpjEgkXBWNFF4tkgS7Z/nAiPW61f89owfFY0qYFx2ylla2ebb2mWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494765; a=rsa-sha256; cv=none; b=S8FgHPbR+XOnuCusN5an5cx5Eg6MRzMKl7AxZ1DCG+ZNVU9TISuHirBY3v5NK0BA+RAz6J 2dWu92HUic5lRxicec5OpWJk56dM38SVpWDs5ZeNVno2lvAx9mU2krkLM8tojvCxJGdCTd UegFergunx7UYES0ttNrqkZNCRNHvD4ilGllPf/Lhrw3O0LtM2GOBJeTctg9H3oxMSQibS 7ccUMrvLza03oVxLx+dLuZ3m3wDw6GK6su4XdchGIAWloCxEx+vXR5xElLPlHkDhP7Aaia Y3EBeIwj0bmia2olB76w/X/eT6x/+5iYMAXIJjtjpEFnmy5R8ZJg9h2+oKIkxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=2d05c4f018fa4514c3ee5391802ce9eadcc5e140 commit 2d05c4f018fa4514c3ee5391802ce9eadcc5e140 Author: Dmitry Chagin AuthorDate: 2022-04-26 16:35:56 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:34:04 +0000 linux(4): Add linux_epoll_pwait_ts() helper for future use. MFC after: 2 weeks (cherry picked from commit 27a25179c8356d58b5df6303d850050122f020c6) --- sys/compat/linux/linux_event.c | 43 +++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c index 44b1a1526e3c..661e68ce4289 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -421,15 +421,15 @@ leave1: /* * Wait for a filter to be triggered on the epoll file descriptor. */ + static int -linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event *events, - int maxevents, int timeout, sigset_t *uset) +linux_epoll_wait_ts(struct thread *td, int epfd, struct epoll_event *events, + int maxevents, struct timespec *tsp, sigset_t *uset) { struct epoll_copyout_args coargs; struct kevent_copyops k_ops = { &coargs, epoll_kev_copyout, NULL}; - struct timespec ts, *tsp; cap_rights_t rights; struct file *epfp; sigset_t omask; @@ -467,20 +467,6 @@ linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event *events, coargs.count = 0; coargs.error = 0; - /* - * Linux epoll_wait(2) man page states that timeout of -1 causes caller - * to block indefinitely. Real implementation does it if any negative - * timeout value is passed. - */ - if (timeout >= 0) { - /* Convert from milliseconds to timespec. */ - ts.tv_sec = timeout / 1000; - ts.tv_nsec = (timeout % 1000) * 1000000; - tsp = &ts; - } else { - tsp = NULL; - } - error = kern_kevent_fp(td, epfp, 0, maxevents, &k_ops, tsp); if (error == 0 && coargs.error != 0) error = coargs.error; @@ -500,6 +486,29 @@ leave: return (error); } +static int +linux_epoll_wait_common(struct thread *td, int epfd, struct epoll_event *events, + int maxevents, int timeout, sigset_t *uset) +{ + struct timespec ts, *tsp; + + /* + * Linux epoll_wait(2) man page states that timeout of -1 causes caller + * to block indefinitely. Real implementation does it if any negative + * timeout value is passed. + */ + if (timeout >= 0) { + /* Convert from milliseconds to timespec. */ + ts.tv_sec = timeout / 1000; + ts.tv_nsec = (timeout % 1000) * 1000000; + tsp = &ts; + } else { + tsp = NULL; + } + return (linux_epoll_wait_ts(td, epfd, events, maxevents, tsp, uset)); + +} + #ifdef LINUX_LEGACY_SYSCALLS int linux_epoll_wait(struct thread *td, struct linux_epoll_wait_args *args)