Module Name: src
Committed By: riastradh
Date: Thu Jul 27 01:48:49 UTC 2023
Modified Files:
src/sys/kern: kern_tc.c
Log Message:
kern: Restore non-atomic time_second symbol.
This is used by savecore(8), vmstat(8), and possibly other things.
XXX Should really teach dump and savecore(8) to use an intentionally
designed header, rather than relying on kvm(3) -- and make it work
for saving cores from other kernels so you don't have to boot the
same buggy kernel to get a core dump.
To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/kern/kern_tc.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_tc.c
diff -u src/sys/kern/kern_tc.c:1.73 src/sys/kern/kern_tc.c:1.74
--- src/sys/kern/kern_tc.c:1.73 Mon Jul 17 21:51:45 2023
+++ src/sys/kern/kern_tc.c Thu Jul 27 01:48:49 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.73 2023/07/17 21:51:45 riastradh Exp $ */
+/* $NetBSD: kern_tc.c,v 1.74 2023/07/27 01:48:49 riastradh Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.73 2023/07/17 21:51:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.74 2023/07/27 01:48:49 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -133,6 +133,9 @@ static struct timehands *volatile timeha
struct timecounter *timecounter = &dummy_timecounter;
static struct timecounter *timecounters = &dummy_timecounter;
+/* used by savecore(8) */
+time_t time_second_legacy asm("time_second");
+
#ifdef __HAVE_ATOMIC64_LOADSTORE
volatile time_t time__second __cacheline_aligned = 1;
volatile time_t time__uptime __cacheline_aligned = 1;
@@ -164,6 +167,8 @@ static inline void
setrealuptime(time_t second, time_t uptime)
{
+ time_second_legacy = second;
+
atomic_store_relaxed(&time__second, second);
atomic_store_relaxed(&time__uptime, uptime);
}
@@ -178,6 +183,8 @@ setrealuptime(time_t second, time_t upti
KDASSERT(mutex_owned(&timecounter_lock));
+ time_second_legacy = second;
+
/*
* Fast path -- no wraparound, just updating the low bits, so
* no need for seqlocked access.