From nobody Fri Jun 17 19:39:48 2022 X-Original-To: dev-commits-src-all@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 D630185C70A; Fri, 17 Jun 2022 19:39:49 +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 4LPqBF2K16z3RLB; Fri, 17 Jun 2022 19:39:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494789; 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=iJRxkv6dg9MfNg0w9fkcD7tb92OISjDh5HL0cYSFPns=; b=Xr2zLSLFpYhgnA80yLtGBY22QKE+n1c8/xJJr90Hla8mtaExHjahhy1b5IaFcg/vEOXeN/ HUizljNGml3nlWdtOY30ObGSogpDXHIxY0NTsK8rX8msvSYQaOMgReLfh2hsj0wLW9MjC3 St1wvffikomR8kQ0bSMUfr4SsoQtv/9JwVRVTzj4SfOffL7vKI7sQPG4pZ+9eOJ4ziq4uv No8DcQrA8KLq4jhdzBuClA0wOTBttDu9RO5tbmsgvE8dAXZaVpPZ2WgFb07C9WuBmY3jZG DYMRokEdGTC86guPXQcQodZXo89DeX5BL0jxU9f5t3rsVK1Tm1nWFkk+YYG/+Q== 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 32520257E0; Fri, 17 Jun 2022 19:39:48 +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 25HJdm2n016491; Fri, 17 Jun 2022 19:39:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJdmLv016490; Fri, 17 Jun 2022 19:39:48 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:39:48 GMT Message-Id: <202206171939.25HJdmLv016490@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: d32db5360bee - stable/13 - linux(4): Implement timerfd_gettime64 syscall. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: d32db5360bee9de70603db121f8ca05d2eb21a63 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494789; 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=iJRxkv6dg9MfNg0w9fkcD7tb92OISjDh5HL0cYSFPns=; b=poNhgaXcNzZnXYkFolb0PujeMUTQx+GJnPXPaQvIAafKhzlUSDY/K8doeFSLCgcoFJc+P0 36kXaM507jgQmUEal/142bUI0a8QleK/DeBHlqCt0Zb2jSxUuQO4sQ8k8bn6YaGf1WJ59B znAYSe8TAANmLYv16AetX6jajt8wjxSF6xNlYz5oEIwWEEYTznflE3Mkkil56NcscN0Tm3 AR8dBIlFZtVvjaDTfC/H1zuJD0G1yyIhm5KREjdGYOhM8vv/RPs3rRRzlbVswLrcXh/WRD BGcNfN8oUio7hgVYPHtv2p0JajTu0XO+YQN54PdlBnq4fJzwHrZ9stt4xkg+QA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494789; a=rsa-sha256; cv=none; b=WWxBFZp96wKHu/+wZzR3l+6I3bFSSe7/HDD7uJquEv70zJ4eA+A1mbqnEGDDhYBogqLGBt kUkRWD5A0IrdnSeCFDmczZ6ejKM2DaGvMl1jn/QJ7ZjMGunMnv9qbPksGxvERgfx1Iwsa1 +S3zGRhaEsE0SrJdxm3AzEbk+zU1Rg68xLHYNBabSNr8wdiW07k+GAVmB+jMgsttbvDMr0 NYa+7d0YddwLi+S1EL2nwcPeqilCAt5zb34exuHAqqbafnY1NLemF102AWVf0grlTkOore yPnmc8E7357tTsNnmKcxPo8dBemNqf+GdYDcc1EX2jwsoBt8iejpePCPrWJQHQ== 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=d32db5360bee9de70603db121f8ca05d2eb21a63 commit d32db5360bee9de70603db121f8ca05d2eb21a63 Author: Dmitry Chagin AuthorDate: 2022-05-04 10:06:52 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:34:37 +0000 linux(4): Implement timerfd_gettime64 syscall. MFC after: 2 weeks (cherry picked from commit ce9f8d6ab00c491f84a021b23a28a1484ef817d8) --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/compat/linux/linux_event.c | 44 +++++++++++++++++++++++++------ sys/i386/linux/linux_dummy_machdep.c | 1 - 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index 6b264e2891f1..0cc1cd581c32 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -68,7 +68,6 @@ DUMMY(mq_getsetattr); DUMMY(arch_prctl); /* Linux 5.0: */ DUMMY(clock_adjtime64); -DUMMY(timerfd_gettime64); DUMMY(io_pgetevents_time64); DUMMY(recvmmsg_time64); DUMMY(mq_timedsend_time64); diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c index f3191c910013..1ac1052def7b 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -902,16 +902,14 @@ linux_timerfd_curval(struct timerfd *tfd, struct itimerspec *ots) } } -int -linux_timerfd_gettime(struct thread *td, struct linux_timerfd_gettime_args *args) +static int +linux_timerfd_gettime_common(struct thread *td, int fd, struct itimerspec *ots) { - struct l_itimerspec lots; - struct itimerspec ots; struct timerfd *tfd; struct file *fp; int error; - error = fget(td, args->fd, &cap_read_rights, &fp); + error = fget(td, fd, &cap_read_rights, &fp); if (error != 0) return (error); tfd = fp->f_data; @@ -921,17 +919,47 @@ linux_timerfd_gettime(struct thread *td, struct linux_timerfd_gettime_args *args } mtx_lock(&tfd->tfd_lock); - linux_timerfd_curval(tfd, &ots); + linux_timerfd_curval(tfd, ots); mtx_unlock(&tfd->tfd_lock); +out: + fdrop(fp, td); + return (error); +} + +int +linux_timerfd_gettime(struct thread *td, struct linux_timerfd_gettime_args *args) +{ + struct l_itimerspec lots; + struct itimerspec ots; + int error; + + error = linux_timerfd_gettime_common(td, args->fd, &ots); + if (error != 0) + return (error); error = native_to_linux_itimerspec(&lots, &ots); if (error == 0) error = copyout(&lots, args->old_value, sizeof(lots)); + return (error); +} -out: - fdrop(fp, td); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_timerfd_gettime64(struct thread *td, struct linux_timerfd_gettime64_args *args) +{ + struct l_itimerspec64 lots; + struct itimerspec ots; + int error; + + error = linux_timerfd_gettime_common(td, args->fd, &ots); + if (error != 0) + return (error); + error = native_to_linux_itimerspec64(&lots, &ots); + if (error == 0) + error = copyout(&lots, args->old_value, sizeof(lots)); return (error); } +#endif static int linux_timerfd_settime_common(struct thread *td, int fd, int flags, diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index f5852e97ddae..4619fa226a72 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -70,7 +70,6 @@ DUMMY(vm86old); DUMMY(arch_prctl); /* Linux 5.0: */ DUMMY(clock_adjtime64); -DUMMY(timerfd_gettime64); DUMMY(io_pgetevents_time64); DUMMY(recvmmsg_time64); DUMMY(mq_timedsend_time64);