From nobody Wed May 04 10:08:20 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 CE9F71AAB1C8; Wed, 4 May 2022 10:08:20 +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 4KtXb82HJmz4dQ8; Wed, 4 May 2022 10:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651658900; 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=+4AC3TfiQblwGW4ZOiSkhVAHCZn0U8sty8iTAJRVMjs=; b=vpwmIGDZoKXcvPaZWrJoT6usIpRQBK+uPqLvPhlrzon/HyD6sG8LC9rcTWjxY5DV6ljB9N 0Gb2bA3AoF/w6mT+50Mwcxpul7zOhrc4NhEApHzjPNmwn0fQJHa12/sDZ42Wo9rfA5tPKy jK4HfHMP+Rhma+K3odAVX3vgqX8UhlQkdv5hBUdLrtOog9/r2DB32Yyc1PXtGiE+te+NRv XnR+AR8zInNTrReQSo7HGNmm6q5Z5+rwz7iR1o5mtEyegnlVhzWIsBpNhO1j36V2BXFVaY wVn5iJ5XHKCnYvn00HcG30lR9kZR4TBSXMrhRHns4Wt8LuY6su9+EcH5ERyHDg== 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 26E9510FDA; Wed, 4 May 2022 10:08:20 +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 244A8KFj000594; Wed, 4 May 2022 10:08:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 244A8KgG000593; Wed, 4 May 2022 10:08:20 GMT (envelope-from git) Date: Wed, 4 May 2022 10:08:20 GMT Message-Id: <202205041008.244A8KgG000593@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: ce9f8d6ab00c - main - 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/main X-Git-Reftype: branch X-Git-Commit: ce9f8d6ab00c491f84a021b23a28a1484ef817d8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651658900; 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=+4AC3TfiQblwGW4ZOiSkhVAHCZn0U8sty8iTAJRVMjs=; b=aCqZSmFFDvhMreG5xHSzUR8L6gf6Y8NO+0YGsJTTdoKkt0rtIsFe62Osl4xZU/3gvez4mj Gwv1oSEttvu8g88Mq//uNpOrbIFckNJcDzEQQkd0KyH9RjWerGne2CFejGOjxTVQJHdWCG djGltvma/cxBUVDr4ShwgrcwwbWDBvkMNorxOaSOVyWg5couT21wce4zQLhydmF4DKBbJD dRjrTI/mFowjDW4e87K8aRPg9D1gWx58OBMOqiFZ2B/Pnej5Jwi3iqUKEZAVOYuinJ/nSc dqYiY28tf5ClTRamGnjKUHwYBV6g1WbWFM73XbGlTFjJW1vuIB8HRMOjDEAT6w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651658900; a=rsa-sha256; cv=none; b=GJw7G8xr/vVx6rG6RmorwK3FUpBQaoMUxZBxzzpQsfswrHrKCfVQ+mozMGqBx4+xPlf2wq PuzxJUvnOtasYq7IYGTljGo75rwn6HLm7DZWctHy5NUfE4DhbZP4i7WPgnQX48bTNhzM5H dBGWmzepG3Cs6RvYBS0I7rD0gIvZmVwmTVIOTJBBELJ2xgyz42mq/DPj5jNJUQoFQThDOm 24mMvZnnw8KsmJkoybKfyGydthXay+nvOpEt1A4PQCGJbQeA4QcGf8nUPIaNoXllMNFwDp gL64jv8aHMennWk7/eF4DpZ3vsUswWOUsQwgEFLnz9qFtvVCKx4Syb78oa2/Hw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=ce9f8d6ab00c491f84a021b23a28a1484ef817d8 commit ce9f8d6ab00c491f84a021b23a28a1484ef817d8 Author: Dmitry Chagin AuthorDate: 2022-05-04 10:06:52 +0000 Commit: Dmitry Chagin CommitDate: 2022-05-04 10:06:52 +0000 linux(4): Implement timerfd_gettime64 syscall. MFC after: 2 weeks --- 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 09c6391f88d2..5e62848303f1 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -901,16 +901,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; @@ -920,17 +918,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);