summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorcheloha <cheloha@openbsd.org>2019-05-20 18:16:59 +0000
committercheloha <cheloha@openbsd.org>2019-05-20 18:16:59 +0000
commit08e05d413b115143352d0000e7558d810bd9c2fd (patch)
tree9a03a45124e1eac422c5691079c8b047ba448edd /sys
parentdrop fatalx calls when claiming a new vm id; otherwise it's possible (diff)
downloadwireguard-openbsd-08e05d413b115143352d0000e7558d810bd9c2fd.tar.xz
wireguard-openbsd-08e05d413b115143352d0000e7558d810bd9c2fd.zip
kern.timecounter.choices: Don't offer the dummy counter as an option.
The dummy counter is a stopgap during boot. It is not useful after a real timecounter is attached and started and there is no reason to return to using it. So don't even offer it to the admin. This is easy: never add it to the timecounter list. It will effectively cease to exist after the first real timecounter is actived in tc_init(). In principle this means that we can have an empty timecounter list so we need to check for that case in sysctl_tc_choice(). "I don't mind" mpi@, ok visa@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_tc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 72ee0900c95..86a367ba830 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_tc.c,v 1.45 2019/05/10 18:53:13 cheloha Exp $ */
+/* $OpenBSD: kern_tc.c,v 1.46 2019/05/20 18:16:59 cheloha Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
@@ -110,7 +110,7 @@ struct mutex windup_mtx = MUTEX_INITIALIZER(IPL_CLOCK);
static struct timehands *volatile timehands = &th0; /* [w] */
struct timecounter *timecounter = &dummy_timecounter; /* [t] */
-static struct timecounter *timecounters = &dummy_timecounter;
+static struct timecounter *timecounters = NULL;
volatile time_t time_second = 1;
volatile time_t time_uptime = 0;
@@ -633,6 +633,9 @@ sysctl_tc_choice(void *oldp, size_t *oldlenp, void *newp, size_t newlen)
struct timecounter *tc;
int error, maxlen;
+ if (timecounters == NULL)
+ return (sysctl_rdstring(oldp, oldlenp, newp, ""));
+
spc = "";
maxlen = 0;
for (tc = timecounters; tc != NULL; tc = tc->tc_next)