From nobody Fri Jun 17 19:28:57 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 A590B846DC6; Fri, 17 Jun 2022 19:28:58 +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 4LPpxk1Ybxz3GtZ; Fri, 17 Jun 2022 19:28:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494138; 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=x7CjM4SzbN7OOuSebeFe0wPnwHpRnGvIJKVPDBHBcfM=; b=FS8RzM1J4amkSSWfVAW9wLLPM2+3SS79nMfQLPDESuFqhXIyFzUX9XNrUwCxm3hyXQ0I+B m7qxb5RS7inYAQJB9ouZwK7qBfEnRlaTaTYqnF++clySAWksFwLL1W766wXgAAgpLtX6P6 8probNCjxYG/IvnQN5WhlhhxfOxvbiQOP0gVeprTnAF6ucdBFY9/PEC24w0qLAFwMcQoPT 3fJguVJQ3F83cEOXUeuRDn8lnVI75L9lopPRa4lRz54pGJaombwgZm51pOi8tr2ZRBONVD yLend7q8JowQEm6vsMBo2nivwny8u6L81ADjFHeFVqbHeoPdBqF98GkNPz/OZA== 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 B8DD925876; Fri, 17 Jun 2022 19:28:57 +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 25HJSvnt096764; Fri, 17 Jun 2022 19:28:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJSvOH096763; Fri, 17 Jun 2022 19:28:57 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:28:57 GMT Message-Id: <202206171928.25HJSvOH096763@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: b004647240e7 - stable/13 - linux(4): Implement clock_settime64 system call. 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: b004647240e7242b3246714c2db360563d8d76cb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494138; 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=x7CjM4SzbN7OOuSebeFe0wPnwHpRnGvIJKVPDBHBcfM=; b=cxHSOl3YA8sFzly7oYoEWHc+i5x9bjpWjsjsZcpfkUzmSP/JxeWlv70gfjEdlBJaSKXLyG +TLnosQUqsqfkthyZ1e4hIeVDCnazzbaDwm8lhrSBiCOREpmshspXyqtHY1smaa1eTNy/e UG0VsZBR7JIU5+rUmqde4tqCCZH8Sw5Ta1lTp8D7rdbXi8AfcTxiQFKjjbRlLL3phmVgYf zapRdAwyhjRlH8FBbqzRq0sJVR00ArYyZivrLP1AlYZWrvviuilAeTpQhgZsjrokTinX/G kOd6I6sMBDT7zkVVfscGXvh6on+U1w0Nk9/QPpM9t9k9+CjajbTzKcYVkq7svg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494138; a=rsa-sha256; cv=none; b=ibuRgbVaFvMGHJCDDhjCFKpFIa7k1M9UdcAkQJYsAoC4fDk/otlHcjWGvG5uPoz1ECZ2h6 iNRX+CTcQwo6rLjWs9ZqrSHGa4bXFB8uSuBB4F0psPxbS89vwD21c++xdUAeUouM/99qCk uURjNoAxyYbAqCcHJpA75weC3qur4A6fs6tqsyVtx74fBt1Fc27yB5kdujFLCK3zidgmBe QDjbhvjRIhyZLNAEyLYXhwM/hf9wvxfdAWN9DS5t1FmDk70rTqOUzRY2e9uR4G7ZSYJs7R pBNPrQg0UMu7S7JowzkNP+ZvvsRGae10+Jj5xv2SAyj8eZzmk2AZYLpRNSy6Aw== 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=b004647240e7242b3246714c2db360563d8d76cb commit b004647240e7242b3246714c2db360563d8d76cb Author: Dmitry Chagin AuthorDate: 2021-06-07 02:11:25 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:27:57 +0000 linux(4): Implement clock_settime64 system call. MFC after: 2 weeks (cherry picked from commit 19f9a0e4df54f8d1e99234146024422bdcfa09ce) --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/amd64/linux32/syscalls.master | 5 ++- sys/compat/linux/linux_time.c | 67 ++++++++++++++++++++++++------- sys/i386/linux/linux_dummy_machdep.c | 1 - sys/i386/linux/syscalls.master | 5 ++- 5 files changed, 60 insertions(+), 19 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index 3ff38c7a8584..022fbcbdd0c6 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -67,7 +67,6 @@ DUMMY(mq_getsetattr); /* Linux 4.11: */ DUMMY(arch_prctl); /* Linux 5.0: */ -DUMMY(clock_settime64); DUMMY(clock_adjtime64); DUMMY(clock_getres_time64); DUMMY(clock_nanosleep_time64); diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index dbba97da68f8..924fbce9eac7 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -2347,7 +2347,10 @@ ); } 404 AUE_NULL STD { - int linux_clock_settime64(void); + int linux_clock_settime64( + clockid_t which, + struct l_timespec64 *tp + ); } 405 AUE_NULL STD { int linux_clock_adjtime64(void); diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 10df72ad29f8..65bb4e9b754f 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -87,8 +87,13 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, gettime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, copyout_error, "int"); #endif LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, conversion_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, settime_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_settime, settime_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_settime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, copyin_error, "int"); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime64, conversion_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime64, copyin_error, "int"); +#endif LIN_SDT_PROBE_DEFINE0(time, linux_clock_getres, nullcall); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, getres_error, "int"); @@ -104,6 +109,8 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int"); static int linux_common_clock_gettime(struct thread *, clockid_t, struct timespec *); +static int linux_common_clock_settime(struct thread *, clockid_t, + struct timespec *); int native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) @@ -414,40 +421,70 @@ linux_clock_gettime64(struct thread *td, struct linux_clock_gettime64_args *args } #endif -int -linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args) +static int +linux_common_clock_settime(struct thread *td, clockid_t which, + struct timespec *ts) { - struct timespec ts; - struct l_timespec lts; int error; clockid_t nwhich; - error = linux_to_native_clockid(&nwhich, args->which); + error = linux_to_native_clockid(&nwhich, which); if (error != 0) { linux_msg(curthread, - "unsupported clock_settime clockid %d", args->which); - LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error, + "unsupported clock_settime clockid %d", which); + LIN_SDT_PROBE1(time, linux_common_clock_settime, conversion_error, error); return (error); } - error = copyin(args->tp, <s, sizeof lts); + + error = kern_clock_settime(td, nwhich, ts); + if (error != 0) + LIN_SDT_PROBE1(time, linux_common_clock_settime, + settime_error, error); + + return (error); +} + +int +linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args) +{ + struct timespec ts; + struct l_timespec lts; + int error; + + error = copyin(args->tp, <s, sizeof(lts)); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_settime, copyin_error, error); return (error); } error = linux_to_native_timespec(&ts, <s); - if (error != 0) { + if (error != 0) LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error, error); + + return (linux_common_clock_settime(td, args->which, &ts)); +} + +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_clock_settime64(struct thread *td, struct linux_clock_settime64_args *args) +{ + struct timespec ts; + struct l_timespec64 lts; + int error; + + error = copyin(args->tp, <s, sizeof(lts)); + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_settime64, copyin_error, error); return (error); } - - error = kern_clock_settime(td, nwhich, &ts); + error = linux_to_native_timespec64(&ts, <s); if (error != 0) - LIN_SDT_PROBE1(time, linux_clock_settime, settime_error, error); - - return (error); + LIN_SDT_PROBE1(time, linux_clock_settime64, conversion_error, + error); + return (linux_common_clock_settime(td, args->which, &ts)); } +#endif int linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index 6855573c9358..762dc177b1b0 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -69,7 +69,6 @@ DUMMY(vm86old); /* Linux 4.11: */ DUMMY(arch_prctl); /* Linux 5.0: */ -DUMMY(clock_settime64); DUMMY(clock_adjtime64); DUMMY(clock_getres_time64); DUMMY(clock_nanosleep_time64); diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index b0e305a45332..a8b41605b743 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -2365,7 +2365,10 @@ ); } 404 AUE_NULL STD { - int linux_clock_settime64(void); + int linux_clock_settime64( + clockid_t which, + struct l_timespec64 *tp + ); } 405 AUE_NULL STD { int linux_clock_adjtime64(void);