git: 622365caf3bd - main - ntp_gettime(2): add kern_ntp_gettime

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 12 Nov 2026 10:23:49 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=622365caf3bde45c459e566701ba0c8f9d8afa89

commit 622365caf3bde45c459e566701ba0c8f9d8afa89
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-11-12 10:23:23 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-11-12 10:23:23 +0000

    ntp_gettime(2): add kern_ntp_gettime
    
    Effort:         CHERI upstreaming
    Sponsored by:   Innovate UK
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/2284
---
 sys/kern/kern_ntptime.c | 8 +++++++-
 sys/sys/syscallsubr.h   | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c
index 892a6798ab1f..b42cbafb683f 100644
--- a/sys/kern/kern_ntptime.c
+++ b/sys/kern/kern_ntptime.c
@@ -286,6 +286,12 @@ struct ntp_gettime_args {
 int
 sys_ntp_gettime(struct thread *td, struct ntp_gettime_args *uap)
 {	
+	return (kern_ntp_gettime(td, uap->ntvp));
+}
+
+int
+kern_ntp_gettime(struct thread *td, struct ntptimeval *ntvp)
+{
 	struct ntptimeval ntv;
 
 	memset(&ntv, 0, sizeof(ntv));
@@ -295,7 +301,7 @@ sys_ntp_gettime(struct thread *td, struct ntp_gettime_args *uap)
 	NTP_UNLOCK();
 
 	td->td_retval[0] = ntv.time_state;
-	return (copyout(&ntv, uap->ntvp, sizeof(ntv)));
+	return (copyout(&ntv, ntvp, sizeof(ntv)));
 }
 
 static int
diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h
index 364d36f5ff79..23ba721a3c92 100644
--- a/sys/sys/syscallsubr.h
+++ b/sys/sys/syscallsubr.h
@@ -57,6 +57,7 @@ struct module_stat;
 struct mq_attr;
 struct msghdr;
 struct msqid_ds;
+struct ntptimeval;
 struct pollfd;
 struct ogetdirentries_args;
 struct rlimit;
@@ -393,6 +394,7 @@ int	kern_nmount(struct thread *td, struct iovec *iovp, u_int iovcnt,
 	    int flags32, copyinuio_t *copyinuio_f);
 int	kern_nosys(struct thread *td, int dummy);
 int	kern_ntp_adjtime(struct thread *td, struct timex *ntv, int *retvalp);
+int	kern_ntp_gettime(struct thread *td, struct ntptimeval *ntvp);
 int	kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap,
 	    long *ploff);
 int	kern_ommap(struct thread *td, uintptr_t hint, int len, int oprot,