Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys timecounter(9): Limit scope of time__second/uptime.
details: https://anonhg.NetBSD.org/src/rev/f7a11e46998b
branches: trunk
changeset: 377564:f7a11e46998b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Jul 17 13:44:24 2023 +0000
description:
timecounter(9): Limit scope of time__second/uptime.
Relevant only if __HAVE_ATOMIC64_LOADSTORE -- not updated otherwise.
diffstat:
sys/kern/kern_tc.c | 12 ++++++------
sys/sys/timevar.h | 8 ++++----
2 files changed, 10 insertions(+), 10 deletions(-)
diffs (61 lines):
diff -r d48583b74cdc -r f7a11e46998b sys/kern/kern_tc.c
--- a/sys/kern/kern_tc.c Mon Jul 17 13:42:23 2023 +0000
+++ b/sys/kern/kern_tc.c Mon Jul 17 13:44:24 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.67 2023/07/17 13:42:23 riastradh Exp $ */
+/* $NetBSD: kern_tc.c,v 1.68 2023/07/17 13:44:24 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.67 2023/07/17 13:42:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.68 2023/07/17 13:44:24 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@@ -134,10 +134,10 @@ static struct timehands *volatile timeha
struct timecounter *timecounter = &dummy_timecounter;
static struct timecounter *timecounters = &dummy_timecounter;
-volatile time_t time__second __cacheline_aligned = 1;
-volatile time_t time__uptime __cacheline_aligned = 1;
-
-#ifndef __HAVE_ATOMIC64_LOADSTORE
+#ifdef __HAVE_ATOMIC64_LOADSTORE
+static volatile time_t time__second __cacheline_aligned = 1;
+static volatile time_t time__uptime __cacheline_aligned = 1;
+#else
static volatile struct {
uint32_t lo, hi;
} time__uptime32 __cacheline_aligned = {
diff -r d48583b74cdc -r f7a11e46998b sys/sys/timevar.h
--- a/sys/sys/timevar.h Mon Jul 17 13:42:23 2023 +0000
+++ b/sys/sys/timevar.h Mon Jul 17 13:44:24 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: timevar.h,v 1.50 2023/07/17 12:55:20 riastradh Exp $ */
+/* $NetBSD: timevar.h,v 1.51 2023/07/17 13:44:24 riastradh Exp $ */
/*
* Copyright (c) 2005, 2008, 2020 The NetBSD Foundation, Inc.
@@ -235,15 +235,15 @@ void itimer_gettime(const struct itimer
void ptimer_tick(struct lwp *, bool);
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 */
-
#define time_second getrealtime()
#define time_uptime getuptime()
#define time_uptime32 getuptime32()
#ifdef __HAVE_ATOMIC64_LOADSTORE
+extern volatile time_t time__second; /* current second in the epoch */
+extern volatile time_t time__uptime; /* system uptime in seconds */
+
static inline time_t
getrealtime(void)
{
Home |
Main Index |
Thread Index |
Old Index