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.)
This commit is contained in:
riastradh 2022-10-26 23:23:52 +00:00
parent 69581d3fed
commit b97699a4f0
8 changed files with 26 additions and 27 deletions

View File

@ -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 1.364 2022/10/26 23:22:07 riastradh Exp
#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));

View File

@ -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 1.837 2022/08/20 23:48:50 riastradh Exp
#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;

View File

@ -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_compat_50.c,v 1.52 2021/09/07 11:43:05 rias
#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)

View File

@ -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, const struct netbsd32___adjtime50_args *uap,
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)

View File

@ -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 offset (ns/s) */
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
/*

View File

@ -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,v 1.217 2022/07/01 21:22:44 riastradh Ex
#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 struct sys___adjtime50_args *uap,
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));

View File

@ -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, \

View File

@ -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 *) __RENAME(__ntp_gettime50);
#endif
int ntp_adjtime(struct timex *);
__END_DECLS
#endif /* _KERNEL */
#endif /* _SYS_TIMEX_H_ */