From nobody Tue Nov 10 15:54:42 2026 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 4jPB6q17twz6yg9v for ; Tue, 10 Nov 2026 15:54:43 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jPB6p5vmCz4WLs for ; Tue, 10 Nov 2026 15:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794326082; 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=bs3iOzVlvv9EC5E2EFWCLuFSZCWZ3lhakVdELWQrE48=; b=hxSyDEnCc2bYV0NRT+yPWaRH7kM77Yk/q07eADstb5seN6ztHIMosHTA2T2BIMYGoiTxlE P7ZbHZqZ31bKxFILWOU2Fy2GlwchzXMGbeHhgVwjdgoJ5oCtFR+R1zk47HpICPoPV1jTjC +Lus+G+zGslnJXEVj/vhBwHQFtuww9MOkrPwAXJ/GgmiPut7/H+5ffyYuLBC18Gn+jx6bv EIz3dPWOb6JxxFn3Tq55dLJgEheT3queG/pcK66hmTbQtYmgEpgaqcV7Tg1PZUOWnVPOPV GfmNcjx1AxFRbj74Buduol9adenEUdwP2NbUHB6mc4BNEfgwcezd+pZAHpzH6A== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794326082; b=YXtuJ6/2YXswNofYtNXzcZ26QtnzFBCYlGIBUupykLvjMG1NSIMX7e+b4g0puJfPeZoh8a Lq06X1DaBOl9pogzda2zOc6NLycT0gG+/YhX0i83tknavm/DD9xH7P2JNWdKwNkXje1XeK HA7iI1aPDeXjm3qNAOc4sH8+h8xRgb5TQl8aRJQzU55sBWKu8jj2C8vEYUf3fmNm0BLV7u 2MCgrKMFhveSwsQj0G5TQyW+CqUn+8y9nL4kvbDB8CveK2O2LpogH8v8ZBSyKF7uWDV9Uf CEfJjuTRgJYMoCJtksqS46TmU3sNqo7OzrRKOADwTTwMHqDOQmx4f2HNOjfYeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794326082; 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=bs3iOzVlvv9EC5E2EFWCLuFSZCWZ3lhakVdELWQrE48=; b=wP7ela/2Q/8PR+MW0q87tqkqF451ytZKcPdkKPWgd+PwvnYvao9va5g1dSpOQ7qS+HpR1c B4k2Fb9nHTyfH7UAw3FVHt05Ar9icJRRaB1exOvD9D8cWDRtO79MPmq6L2F9lq3EllkhmH zDYUljijPSWeTVRqDmzSmnRzs1Y8vs89gpC+rvFT8ShyaaCKfsVwnng1hUdkQGZIUnEpRu P1dUdUABfi9RlTxoBg5W4E44tHu1RMjdHT1wIVQ6uTgWRQjw4lX+eiCVhoyXI+saRp8GVa PD/6bPv9jFBa8fpSS7BFqr8R6Y8IQ6dpC6oHfjVSu9Ky2Xz7axhSG7tNy2e8gQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jPB6p5b7KzbNc for ; Tue, 10 Nov 2026 15:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 8925 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 10 Nov 2026 15:54:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 22f93edf2014 - main - kern_time.c: add kern_ and user_ implementations List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 22f93edf2014e39cc96822d1bf2e4804350f266f Auto-Submitted: auto-generated Date: Tue, 10 Nov 2026 15:54:42 +0000 Message-Id: <6af33e42.8925.60e42b7c@gitrepo.freebsd.org> The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=22f93edf2014e39cc96822d1bf2e4804350f266f commit 22f93edf2014e39cc96822d1bf2e4804350f266f Author: Brooks Davis AuthorDate: 2025-11-24 15:58:25 +0000 Commit: Brooks Davis CommitDate: 2026-11-10 15:54:20 +0000 kern_time.c: add kern_ and user_ implementations Expose user_clock_nanosleep globally. Effort: CHERI upstreaming Sponsored by: Innovate UK Pull Request: https://github.com/freebsd/freebsd-src/pull/2284 --- sys/kern/kern_time.c | 35 ++++++++++++++++++++++------------- sys/sys/syscallsubr.h | 7 +++++++ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index b9daad17c639..0e637299ae53 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -86,9 +86,6 @@ static uma_zone_t itimer_zone = NULL; static int settime(struct thread *, struct timeval *); static void timevalfix(struct timeval *); -static int user_clock_nanosleep(struct thread *td, clockid_t clock_id, - int flags, const struct timespec *ua_rqtp, - struct timespec *ua_rmtp); static void itimer_start(void *); static int itimer_init(void *, int, int); @@ -631,7 +628,6 @@ struct nanosleep_args { int sys_nanosleep(struct thread *td, struct nanosleep_args *uap) { - return (user_clock_nanosleep(td, CLOCK_REALTIME, TIMER_RELTIME, uap->rqtp, uap->rmtp)); } @@ -655,7 +651,7 @@ sys_clock_nanosleep(struct thread *td, struct clock_nanosleep_args *uap) return (kern_posix_error(td, error)); } -static int +int user_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags, const struct timespec *ua_rqtp, struct timespec *ua_rmtp) { @@ -683,19 +679,25 @@ struct gettimeofday_args { /* ARGSUSED */ int sys_gettimeofday(struct thread *td, struct gettimeofday_args *uap) +{ + return (kern_gettimeofday(td, uap->tp, uap->tzp)); +} + +int +kern_gettimeofday(struct thread *td, struct timeval *tp, struct timezone *tzp) { struct timeval atv; struct timezone rtz; int error = 0; - if (uap->tp) { + if (tp) { microtime(&atv); - error = copyout(&atv, uap->tp, sizeof (atv)); + error = copyout(&atv, tp, sizeof(atv)); } - if (error == 0 && uap->tzp != NULL) { + if (error == 0 && tzp != NULL) { rtz.tz_minuteswest = 0; rtz.tz_dsttime = 0; - error = copyout(&rtz, uap->tzp, sizeof (rtz)); + error = copyout(&rtz, tzp, sizeof(rtz)); } return (error); } @@ -709,20 +711,27 @@ struct settimeofday_args { /* ARGSUSED */ int sys_settimeofday(struct thread *td, struct settimeofday_args *uap) +{ + return (user_settimeofday(td, uap->tv, uap->tzp)); +} + +int +user_settimeofday(struct thread *td, const struct timeval *tv, + const struct timezone *tz) { struct timeval atv, *tvp; struct timezone atz, *tzp; int error; - if (uap->tv) { - error = copyin(uap->tv, &atv, sizeof(atv)); + if (tv) { + error = copyin(tv, &atv, sizeof(atv)); if (error) return (error); tvp = &atv; } else tvp = NULL; - if (uap->tzp) { - error = copyin(uap->tzp, &atz, sizeof(atz)); + if (tz) { + error = copyin(tz, &atz, sizeof(atz)); if (error) return (error); tzp = &atz; diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index 3b4a0b1fa190..200ed205557c 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -271,6 +271,8 @@ int kern_getsid(struct thread *td, pid_t pid); int kern_getsockname(struct thread *td, int fd, struct sockaddr *sa); int kern_getsockopt(struct thread *td, int s, int level, int name, void *optval, enum uio_seg valseg, socklen_t *valsize); +int kern_gettimeofday(struct thread *td, struct timeval *tp, + struct timezone *tzp); int kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data); int kern_jail(struct thread *td, struct jail *j); int kern_jail_get(struct thread *td, struct uio *options, int flags); @@ -528,6 +530,9 @@ int kern_socketpair(struct thread *td, int domain, int type, int protocol, int *rsv); int kern_unmount(struct thread *td, const char *path, uint64_t flags); +int user_clock_nanosleep(struct thread *td, clockid_t clock_id, + int flags, const struct timespec *ua_rqtp, + struct timespec *ua_rmtp); int user_cpuset_getaffinity(struct thread *td, cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *maskp, const struct cpuset_copy_cb *cb); @@ -544,6 +549,8 @@ int user_jail_set(struct thread *td, struct iovec *iovp, unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f); int user_kldload(struct thread *td, const char *file); int user_setgroups(struct thread *td, int gidsetsize, const gid_t *gidset); +int user_settimeofday(struct thread *td, const struct timeval *tv, + const struct timezone *tz); int user_sigprocmask(struct thread *td, int how, const sigset_t *uset, sigset_t *uoset); int user_sigsuspend(struct thread *td, const sigset_t *sigmask);