Module Name: src
Committed By: riastradh
Date: Wed Oct 26 23:23:52 UTC 2022
Modified Files:
src/sys/arch/amd64/amd64: machdep.c
src/sys/arch/i386/i386: machdep.c
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_time.c
src/sys/kern: kern_ntptime.c kern_time.c
src/sys/sys: timevar.h timex.h
Log Message:
sys: Put externs for time_adjtime and time_adjusted in .h files.
time_adjtime: sys/timex.h (defined in ntp code)
time_adjusted: sys/timevar.h (defined in non-ntp code)
(Not really sure this is a valuable distinction to maintain; there's
non-ntp code that uses time_adjtime too.)
To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.837 -r1.838 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.57 -r1.58 src/sys/compat/netbsd32/netbsd32_time.c
cvs rdiff -u -r1.63 -r1.64 src/sys/kern/kern_ntptime.c
cvs rdiff -u -r1.217 -r1.218 src/sys/kern/kern_time.c
cvs rdiff -u -r1.48 -r1.49 src/sys/sys/timevar.h
cvs rdiff -u -r1.19 -r1.20 src/sys/sys/timex.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.364 src/sys/arch/amd64/amd64/machdep.c:1.365
--- src/sys/arch/amd64/amd64/machdep.c:1.364 Wed Oct 26 23:22:07 2022
+++ src/sys/arch/amd64/amd64/machdep.c Wed Oct 26 23:23:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.364 2022/10/26 23:22:07 riastradh Exp $ */
+/* $NetBSD: machdep.c,v 1.365 2022/10/26 23:23:52 riastradh Exp $ */
/*
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.364 2022/10/26 23:22:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.365 2022/10/26 23:23:52 riastradh Exp $");
#include "opt_modular.h"
#include "opt_user_ldt.h"
@@ -154,6 +154,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v
#include <sys/csan.h>
#include <sys/msan.h>
#include <sys/module.h>
+#include <sys/timevar.h>
#ifdef KGDB
#include <sys/kgdb.h>
@@ -303,8 +304,6 @@ void dumpsys(void);
static void x86_64_proc0_pcb_ldt_init(void);
-extern int time_adjusted; /* XXX no common header */
-
void dump_misc_init(void);
void dump_seg_prep(void);
int dump_seg_iter(int (*)(paddr_t, paddr_t));
Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.837 src/sys/arch/i386/i386/machdep.c:1.838
--- src/sys/arch/i386/i386/machdep.c:1.837 Sat Aug 20 23:48:50 2022
+++ src/sys/arch/i386/i386/machdep.c Wed Oct 26 23:23:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.837 2022/08/20 23:48:50 riastradh Exp $ */
+/* $NetBSD: machdep.c,v 1.838 2022/10/26 23:23:52 riastradh Exp $ */
/*
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.837 2022/08/20 23:48:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.838 2022/10/26 23:23:52 riastradh Exp $");
#include "opt_beep.h"
#include "opt_compat_freebsd.h"
@@ -106,6 +106,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v
#include <sys/ras.h>
#include <sys/ksyms.h>
#include <sys/device.h>
+#include <sys/timevar.h>
#ifdef KGDB
#include <sys/kgdb.h>
@@ -250,8 +251,6 @@ void initgdt(union descriptor *);
static void i386_proc0_pcb_ldt_init(void);
-extern int time_adjusted;
-
int *esym;
int *eblob;
extern int boothowto;
Index: src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.52 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.53
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.52 Tue Sep 7 11:43:05 2021
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c Wed Oct 26 23:23:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_50.c,v 1.52 2021/09/07 11:43:05 riastradh Exp $ */
+/* $NetBSD: netbsd32_compat_50.c,v 1.53 2022/10/26 23:23:52 riastradh Exp $ */
/*-
* Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.52 2021/09/07 11:43:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.53 2022/10/26 23:23:52 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -47,6 +47,8 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com
#include <sys/socketvar.h>
#include <sys/stat.h>
#include <sys/time.h>
+#include <sys/timevar.h>
+#include <sys/timex.h>
#include <sys/ktrace.h>
#include <sys/eventvar.h>
#include <sys/resourcevar.h>
@@ -247,9 +249,6 @@ compat_50_netbsd32_adjtime(struct lwp *l
struct netbsd32_timeval50 atv;
int error;
- extern int time_adjusted; /* in kern_ntptime.c */
- extern int64_t time_adjtime; /* in kern_ntptime.c */
-
if ((error = kauth_authorize_system(l->l_cred,
KAUTH_SYSTEM_TIME, KAUTH_REQ_SYSTEM_TIME_ADJTIME, NULL, NULL,
NULL)) != 0)
Index: src/sys/compat/netbsd32/netbsd32_time.c
diff -u src/sys/compat/netbsd32/netbsd32_time.c:1.57 src/sys/compat/netbsd32/netbsd32_time.c:1.58
--- src/sys/compat/netbsd32/netbsd32_time.c:1.57 Mon Sep 20 01:00:55 2021
+++ src/sys/compat/netbsd32/netbsd32_time.c Wed Oct 26 23:23:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_time.c,v 1.57 2021/09/20 01:00:55 thorpej Exp $ */
+/* $NetBSD: netbsd32_time.c,v 1.58 2022/10/26 23:23:52 riastradh Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.57 2021/09/20 01:00:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.58 2022/10/26 23:23:52 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -261,9 +261,6 @@ netbsd32___adjtime50(struct lwp *l, cons
struct netbsd32_timeval atv;
int error;
- extern int time_adjusted; /* in kern_ntptime.c */
- extern int64_t time_adjtime; /* in kern_ntptime.c */
-
if ((error = kauth_authorize_system(l->l_cred,
KAUTH_SYSTEM_TIME, KAUTH_REQ_SYSTEM_TIME_ADJTIME, NULL, NULL,
NULL)) != 0)
Index: src/sys/kern/kern_ntptime.c
diff -u src/sys/kern/kern_ntptime.c:1.63 src/sys/kern/kern_ntptime.c:1.64
--- src/sys/kern/kern_ntptime.c:1.63 Sun Mar 13 12:57:33 2022
+++ src/sys/kern/kern_ntptime.c Wed Oct 26 23:23:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ntptime.c,v 1.63 2022/03/13 12:57:33 riastradh Exp $ */
+/* $NetBSD: kern_ntptime.c,v 1.64 2022/10/26 23:23:52 riastradh Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.63 2022/03/13 12:57:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.64 2022/10/26 23:23:52 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -190,8 +190,6 @@ static l_fp time_freq; /* frequency of
static l_fp time_adj; /* tick adjust (ns/s) */
int64_t time_adjtime; /* correction from adjtime(2) (usec) */
-extern int time_adjusted; /* ntp might have changed the system time */
-
#ifdef NTP
#ifdef PPS_SYNC
/*
Index: src/sys/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.217 src/sys/kern/kern_time.c:1.218
--- src/sys/kern/kern_time.c:1.217 Fri Jul 1 21:22:44 2022
+++ src/sys/kern/kern_time.c Wed Oct 26 23:23:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_time.c,v 1.217 2022/07/01 21:22:44 riastradh Exp $ */
+/* $NetBSD: kern_time.c,v 1.218 2022/10/26 23:23:52 riastradh Exp $ */
/*-
* Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009, 2020
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.217 2022/07/01 21:22:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.218 2022/10/26 23:23:52 riastradh Exp $");
#include <sys/param.h>
#include <sys/resourcevar.h>
@@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_time.c,
#include <sys/signalvar.h>
#include <sys/syslog.h>
#include <sys/timetc.h>
+#include <sys/timevar.h>
#include <sys/timex.h>
#include <sys/kauth.h>
#include <sys/mount.h>
@@ -603,7 +604,6 @@ sys___adjtime50(struct lwp *l, const str
void
adjtime1(const struct timeval *delta, struct timeval *olddelta, struct proc *p)
{
- extern int64_t time_adjtime; /* in kern_ntptime.c */
if (olddelta) {
memset(olddelta, 0, sizeof(*olddelta));
Index: src/sys/sys/timevar.h
diff -u src/sys/sys/timevar.h:1.48 src/sys/sys/timevar.h:1.49
--- src/sys/sys/timevar.h:1.48 Tue Jul 20 08:37:20 2021
+++ src/sys/sys/timevar.h Wed Oct 26 23:23:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: timevar.h,v 1.48 2021/07/20 08:37:20 skrll Exp $ */
+/* $NetBSD: timevar.h,v 1.49 2022/10/26 23:23:52 riastradh Exp $ */
/*
* Copyright (c) 2005, 2008, 2020 The NetBSD Foundation, Inc.
@@ -237,6 +237,8 @@ void ptimers_free(struct proc *, int);
extern volatile time_t time_second; /* current second in the epoch */
extern volatile time_t time_uptime; /* system uptime in seconds */
+extern int time_adjusted;
+
#define DEFAULT_TIMEOUT_EPSILON \
(&(const struct bintime) { \
.sec = 0, \
Index: src/sys/sys/timex.h
diff -u src/sys/sys/timex.h:1.19 src/sys/sys/timex.h:1.20
--- src/sys/sys/timex.h:1.19 Fri Dec 10 20:36:04 2021
+++ src/sys/sys/timex.h Wed Oct 26 23:23:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: timex.h,v 1.19 2021/12/10 20:36:04 andvar Exp $ */
+/* $NetBSD: timex.h,v 1.20 2022/10/26 23:23:52 riastradh Exp $ */
/*-
***********************************************************************
@@ -238,6 +238,7 @@ struct timex {
};
#ifdef _KERNEL
+
#include <sys/mutex.h>
void ntp_update_second(int64_t *adjustment, time_t *newsec);
@@ -246,6 +247,9 @@ void ntp_gettime(struct ntptimeval *);
int ntp_timestatus(void);
extern kmutex_t timecounter_lock;
+
+extern int64_t time_adjtime;
+
#else /* !_KERNEL */
__BEGIN_DECLS
@@ -254,6 +258,7 @@ int ntp_gettime(struct ntptimeval *) __R
#endif
int ntp_adjtime(struct timex *);
__END_DECLS
+
#endif /* _KERNEL */
#endif /* _SYS_TIMEX_H_ */