From nobody Wed May 04 10:08:09 2022 X-Original-To: dev-commits-src-main@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 EAAAE1AAA4A8; Wed, 4 May 2022 10:08:10 +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 4KtXZy27rNz4dK4; Wed, 4 May 2022 10:08:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651658890; 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=6dUtj335LMt4rJXOh6EHHy2pX+N+qXdW7o1UKUFlQK0=; b=y0lWgNclS11czB5MLvwef8gU7k0ZdzLq1gEOC8Jf7nV3em14Xq0PGPdOqY29u157Em76+h wmvV2L4omJH3Pr7lgsXiFfHKHUrtOnl8/GK4GJHiCXoKXN1M1ontWZbEipOpOav0bg4KiC hjF+snSFF97fAN//bFvK4pEGCNV1nhLw+hfo+acUsyk8wVB46QAohj2Now65i6k7uvjDVK eF7fbjjJTbSpxba3GCJBFdwbh6tuQbFWwjjQLSu0CtVavcyQvMp5eWs5c6EdrvdYOzLlc3 sgHuzYkTrMvzRk9DyDI6iMKfHvw2NKXofieMiJZcnIeThyue0BtUDa7SgImQgQ== 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 C802910DF1; Wed, 4 May 2022 10:08:09 +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 244A89Xt000364; Wed, 4 May 2022 10:08:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 244A89uZ000363; Wed, 4 May 2022 10:08:09 GMT (envelope-from git) Date: Wed, 4 May 2022 10:08:09 GMT Message-Id: <202205041008.244A89uZ000363@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: 783c1bd8cb0c - main - linux(4): Implement timer_gettime64 syscall. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 783c1bd8cb0cf02f2cfb95418b0a115ed975086a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651658890; 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=6dUtj335LMt4rJXOh6EHHy2pX+N+qXdW7o1UKUFlQK0=; b=peoYLxMVJZnwpN37Lj8FX6H+x+rvpeWpCgk0wVnnihMVtcdS+v0WeaRY3BwGcT5sS6vhgt RcbL91fiwyZU6Z0b2x1s6xTrPalqtDXdmMN8bhkTtUE4PbYWmSLIaROXnfcCAP7gPEct95 1RwU4BQ7zfYJFm80B1Vr79C8q74KxKFieosHhoXZ9qRE4Vv3j6HEDy4OtuNaQsZOACQTbo 0g9T37kWOTSc7BU+8HwHjKXUeywBzwtZLLT5rptdPawUSY/NT+uOHIFrfZ8amylKJjCvxe djDOjkj9kSFWENuHOeeOFF0ZAO6dpUsVyoPe6DTQWf3rHaczg3F+2r3LimlNcQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651658890; a=rsa-sha256; cv=none; b=lzgPhbxX0VKW5/A9QOBFURdkrGi9YOimaSMoiz3a1cSv94P2wm7DccMpzZRymZUJFbDdbz dSbZkkIKnTrcf6zWKELUeqQwPidP1HRA5jAZw15EXQw/eSJrkbUSaqey18wO9v1cmOfPnQ 7JIpxKI2YX1F0nahC93bpCCTgzGk3GatlrqCa19L/Y/JxqbL+1gLVxy5U7C+0B/RzlyN+O N0RsLikKk5FAVbhlwYL7vfD3bYIr0VHy0mlkvSv7zfgSsdCdVu97+MRzxSS0gg0ICx87cp 0dflw+qjzyKJmXfr0814hafHl0hZYYMuOkCOZ+rSQF1mHZVKMbelPrQ0CoNTOg== 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=783c1bd8cb0cf02f2cfb95418b0a115ed975086a commit 783c1bd8cb0cf02f2cfb95418b0a115ed975086a Author: Dmitry Chagin AuthorDate: 2022-05-04 10:06:48 +0000 Commit: Dmitry Chagin CommitDate: 2022-05-04 10:06:48 +0000 linux(4): Implement timer_gettime64 syscall. MFC after: 2 weeks --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/compat/linux/linux_time.c | 24 ++++++++++++++++++++++++ sys/compat/linux/linux_timer.c | 23 ++++++++++++++++++++--- sys/compat/linux/linux_timer.h | 14 ++++++++++++++ sys/i386/linux/linux_dummy_machdep.c | 1 - 5 files changed, 58 insertions(+), 5 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index e14da5b74733..d6e4d89d573a 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_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64); diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 739480342ad9..447319a7edc9 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -196,6 +196,30 @@ linux_to_native_itimerspec(struct itimerspec *ntp, struct l_itimerspec *ltp) return (error); } +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_to_native_itimerspec64(struct itimerspec *ntp, struct l_itimerspec64 *ltp) +{ + int error; + + error = linux_to_native_timespec64(&ntp->it_interval, <p->it_interval); + if (error == 0) + error = linux_to_native_timespec64(&ntp->it_value, <p->it_value); + return (error); +} + +int +native_to_linux_itimerspec64(struct l_itimerspec64 *ltp, struct itimerspec *ntp) +{ + int error; + + error = native_to_linux_timespec64(<p->it_interval, &ntp->it_interval); + if (error == 0) + error = native_to_linux_timespec64(<p->it_value, &ntp->it_value); + return (error); +} +#endif + int linux_to_native_clockid(clockid_t *n, clockid_t l) { diff --git a/sys/compat/linux/linux_timer.c b/sys/compat/linux/linux_timer.c index 4e1b56d4b2e2..83c099fbc800 100644 --- a/sys/compat/linux/linux_timer.c +++ b/sys/compat/linux/linux_timer.c @@ -146,13 +146,30 @@ linux_timer_gettime(struct thread *td, struct linux_timer_gettime_args *uap) int error; error = kern_ktimer_gettime(td, uap->timerid, &val); - if (error == 0) { - ITS_CP(val, l_val); + if (error == 0) + error = native_to_linux_itimerspec(&l_val, &val); + if (error == 0) error = copyout(&l_val, uap->setting, sizeof(l_val)); - } return (error); } +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_timer_gettime64(struct thread *td, struct linux_timer_gettime64_args *uap) +{ + struct l_itimerspec64 l_val; + struct itimerspec val; + int error; + + error = kern_ktimer_gettime(td, uap->timerid, &val); + if (error == 0) + error = native_to_linux_itimerspec64(&l_val, &val); + if (error == 0) + error = copyout(&l_val, uap->setting, sizeof(l_val)); + return (error); +} +#endif + int linux_timer_getoverrun(struct thread *td, struct linux_timer_getoverrun_args *uap) { diff --git a/sys/compat/linux/linux_timer.h b/sys/compat/linux/linux_timer.h index 6b5cf346049e..7617316b09c6 100644 --- a/sys/compat/linux/linux_timer.h +++ b/sys/compat/linux/linux_timer.h @@ -104,6 +104,13 @@ struct l_itimerspec { struct l_timespec it_value; }; +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +struct l_itimerspec64 { + struct l_timespec64 it_interval; + struct l_timespec64 it_value; +}; +#endif + int native_to_linux_timespec(struct l_timespec *, struct timespec *); int linux_to_native_timespec(struct timespec *, @@ -119,6 +126,13 @@ int native_to_linux_itimerspec(struct l_itimerspec *, struct itimerspec *); int linux_to_native_itimerspec(struct itimerspec *, struct l_itimerspec *); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int native_to_linux_itimerspec64(struct l_itimerspec64 *, + struct itimerspec *); +int linux_to_native_itimerspec64(struct itimerspec *, + struct l_itimerspec64 *); +#endif + int linux_to_native_timerflags(int *, int); #endif /* _LINUX_TIMER_H */ diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index cbe945e00635..57edba56004f 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_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64);