Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Add code to detect attaching of evcnt before evcnt ...
details: https://anonhg.NetBSD.org/src/rev/62835c1dadb6
branches: trunk
changeset: 760988:62835c1dadb6
user: matt <matt%NetBSD.org@localhost>
date: Tue Jan 18 08:16:43 2011 +0000
description:
Add code to detect attaching of evcnt before evcnt has been initialized.
diffstat:
sys/kern/subr_evcnt.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (50 lines):
diff -r bc205d5b0dd3 -r 62835c1dadb6 sys/kern/subr_evcnt.c
--- a/sys/kern/subr_evcnt.c Tue Jan 18 08:15:51 2011 +0000
+++ b/sys/kern/subr_evcnt.c Tue Jan 18 08:16:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.7 2010/12/11 22:30:54 matt Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.8 2011/01/18 08:16:43 matt Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.7 2010/12/11 22:30:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.8 2011/01/18 08:16:43 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -87,6 +87,7 @@
/* list of all events */
struct evcntlist allevents = TAILQ_HEAD_INITIALIZER(allevents);
static kmutex_t evmtx;
+static bool init_done;
/*
* We need a dummy object to stuff into the evcnt link set to
@@ -105,8 +106,12 @@
__link_set_decl(evcnts, struct evcnt);
struct evcnt * const *evp;
+ KASSERT(!init_done);
+
mutex_init(&evmtx, MUTEX_DEFAULT, IPL_NONE);
+ init_done = true;
+
__link_set_foreach(evp, evcnts) {
if (*evp == &dummy_static_evcnt)
continue;
@@ -123,6 +128,10 @@
{
int len;
+ KASSERTMSG(init_done,
+ ("%s: evcnt non initialized: group=<%s> name=<%s>",
+ __func__, ev->ev_group, ev->ev_name));
+
len = strlen(ev->ev_group);
#ifdef DIAGNOSTIC
if (len >= EVCNT_STRING_MAX) /* ..._MAX includes NUL */
Home |
Main Index |
Thread Index |
Old Index