From owner-dev-commits-src-all@freebsd.org Sun Jun 6 14:13:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2557465F1EE; Sun, 6 Jun 2021 14:13:50 +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 4Fydlf0YNjz4qrN; Sun, 6 Jun 2021 14:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EF39425080; Sun, 6 Jun 2021 14:13:49 +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 156EDnpX033195; Sun, 6 Jun 2021 14:13:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156EDn5D033194; Sun, 6 Jun 2021 14:13:49 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:13:49 GMT Message-Id: <202106061413.156EDn5D033194@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: 19f9a0e4df54 - main - linux(4): Implement clock_settime64 system call. 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: 19f9a0e4df54f8d1e99234146024422bdcfa09ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:13:50 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=19f9a0e4df54f8d1e99234146024422bdcfa09ce commit 19f9a0e4df54f8d1e99234146024422bdcfa09ce Author: Dmitry Chagin AuthorDate: 2021-06-07 02:11:25 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:11:25 +0000 linux(4): Implement clock_settime64 system call. MFC after: 2 weeks --- 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);