From nobody Fri Jun 17 19:39:41 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 2F47385C3D5; Fri, 17 Jun 2022 19:39:42 +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 4LPqB55rcdz3gxx; Fri, 17 Jun 2022 19:39:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494781; 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=GiWbiZEGo+hG2Q9juByMaakeYcmSujSbmtPiFRC9I+g=; b=LYPHFcL8SYp/vge67eHr/EvRSINCwJxyFOWzAxqcA6vf1IHu3Ycq4KwDNs/AFSNZz2AQFx 61cAUhasGCVWFAmfCLMYf0suf5iFmhuXQLIQ6PhA3ziYsQIurNTVxrQczjpCFUIwqII0bT Z2tAnpjpnlqby3U14vskufurxYyQur9YgnE9sE+jUa5lKd+IqiZnBIWu0hU5EehpMHS/bM 4Zo+q2D5v9vF5tWYaVBtyTI/2MBHXatjpCGSiEXskDEpn9K2UAogP/pNI2GRhuvw5CU86r q3AitXJHCnZ16VEKGRl5Zt8vD/oK+ZdwH7nsdbotjzKop7MFNaj8yRsCXwOFkw== 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 5F37925AE1; Fri, 17 Jun 2022 19:39:41 +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 25HJdfg4016341; Fri, 17 Jun 2022 19:39:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJdfD2016340; Fri, 17 Jun 2022 19:39:41 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:39:41 GMT Message-Id: <202206171939.25HJdfD2016340@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: ad5e9b986753 - stable/13 - linux(4): Implement timer_settime64 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: ad5e9b9867539c6058e13b0054b9a0c5f2789aa1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494781; 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=GiWbiZEGo+hG2Q9juByMaakeYcmSujSbmtPiFRC9I+g=; b=lyZiEKCrYu6W5vD+BeXM1+BCb1cn6pg233+j2+lfKzlJMIGbchPK5ed6zNlb90dCLzbxTP tvN5dq+YcQQ35CCQXKdyZdV+EPjtNf27DK7vyQUsLCStk0cYcpYiLtf0VDBGs/GfkmDPfJ 5eH7cvGyw11dNZKf/jYW579VMGNTriNbOzXGka6XdLZ/FXLY7OK4aRdFxQ1Gt6SVXbp4x+ xhBoocYArQ46WWt+tfWMTjRb7aI8SZiGUvk7k/iAePzpko1ObacWsIJnORQe2BtnXtmPg8 TcOCpZMQoc+b2G/iT527P4XRGvoPaTvyh1Juxo0un7YHEff9v0CG5BMaRHYTpw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494781; a=rsa-sha256; cv=none; b=qHYRhI7/AaffZ7gdAXEUDbnfli27/OPe0LnemmATCAv5ir3hvig//uGiS3HljITxg6vja7 sW1kQrHL3XElz9fQ0/WaXzEacJfltQniG6Eaq/5zw930InD8/oMugVpPLLHXVz6NLrmmqb oBgrt8ebIDf0dtqe4gizaXZwgC96RgnyMi//EzZIjW8JABFRQPWbrKs4awKUafZ86KNQvH Pu4K1v4S1qeV19wCP6o01cenReuWubaiKPZ4i9IQsscgmBcqLPM0e9Ce+/F76xKy02SIrO XwKgJHBvAwcGf9l94p71tWygEYVlOpoLYG3hrc4N1+VKIEhqdn//fKce/10Wqw== 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=ad5e9b9867539c6058e13b0054b9a0c5f2789aa1 commit ad5e9b9867539c6058e13b0054b9a0c5f2789aa1 Author: Dmitry Chagin AuthorDate: 2022-05-04 10:06:49 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:34:26 +0000 linux(4): Implement timer_settime64 syscall. MFC after: 2 weeks (cherry picked from commit a1fd2911ddb06c1a2d23ebb636a46bc20ca498e7) --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/compat/linux/linux_timer.c | 44 +++++++++++++++++++++++++++---- sys/i386/linux/linux_dummy_machdep.c | 1 - 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index d6e4d89d573a..7dbc3352b07d 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(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64); DUMMY(io_pgetevents_time64); diff --git a/sys/compat/linux/linux_timer.c b/sys/compat/linux/linux_timer.c index 83c099fbc800..3e844704f132 100644 --- a/sys/compat/linux/linux_timer.c +++ b/sys/compat/linux/linux_timer.c @@ -123,20 +123,54 @@ linux_timer_settime(struct thread *td, struct linux_timer_settime_args *uap) { struct l_itimerspec l_val, l_oval; struct itimerspec val, oval, *ovalp; - int error; + int flags, error; + + error = copyin(uap->new, &l_val, sizeof(l_val)); + if (error != 0) + return (error); + error = linux_to_native_itimerspec(&val, &l_val); + if (error != 0) + return (error); + ovalp = uap->old != NULL ? &oval : NULL; + error = linux_to_native_timerflags(&flags, uap->flags); + if (error != 0) + return (error); + error = kern_ktimer_settime(td, uap->timerid, flags, &val, ovalp); + if (error == 0 && uap->old != NULL) { + error = native_to_linux_itimerspec(&l_val, &val); + if (error == 0) + error = copyout(&l_oval, uap->old, sizeof(l_oval)); + } + return (error); +} + +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_timer_settime64(struct thread *td, struct linux_timer_settime64_args *uap) +{ + struct l_itimerspec64 l_val, l_oval; + struct itimerspec val, oval, *ovalp; + int flags, error; error = copyin(uap->new, &l_val, sizeof(l_val)); if (error != 0) return (error); - ITS_CP(l_val, val); + error = linux_to_native_itimerspec64(&val, &l_val); + if (error != 0) + return (error); ovalp = uap->old != NULL ? &oval : NULL; - error = kern_ktimer_settime(td, uap->timerid, uap->flags, &val, ovalp); + error = linux_to_native_timerflags(&flags, uap->flags); + if (error != 0) + return (error); + error = kern_ktimer_settime(td, uap->timerid, flags, &val, ovalp); if (error == 0 && uap->old != NULL) { - ITS_CP(oval, l_oval); - error = copyout(&l_oval, uap->old, sizeof(l_oval)); + error = native_to_linux_itimerspec64(&l_val, &val); + if (error == 0) + error = copyout(&l_oval, uap->old, sizeof(l_oval)); } return (error); } +#endif int linux_timer_gettime(struct thread *td, struct linux_timer_gettime_args *uap) diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index 57edba56004f..f4280da8df16 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(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64); DUMMY(io_pgetevents_time64);