Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sysmon When unregistering a device, in addition to r...
details: https://anonhg.NetBSD.org/src/rev/3beb907c5601
branches: trunk
changeset: 753602:3beb907c5601
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sat Apr 03 13:55:09 2010 +0000
description:
When unregistering a device, in addition to reducing the global count
of sensors, we need to adjust the sme_fsensor values for some devices.
Failure to do this leaves a sparesly-populated number-space and can
subsequently result in overlapping sensors number assignments. (This
only affects the compatability-mode API, but still needs to be fixed.)
diffstat:
sys/dev/sysmon/sysmon_envsys.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diffs (45 lines):
diff -r c9eb777ab782 -r 3beb907c5601 sys/dev/sysmon/sysmon_envsys.c
--- a/sys/dev/sysmon/sysmon_envsys.c Sat Apr 03 11:55:41 2010 +0000
+++ b/sys/dev/sysmon/sysmon_envsys.c Sat Apr 03 13:55:09 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys.c,v 1.104 2010/04/01 12:16:14 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsys.c,v 1.105 2010/04/03 13:55:09 pgoyette Exp $ */
/*-
* Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.104 2010/04/01 12:16:14 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.105 2010/04/03 13:55:09 pgoyette Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -860,6 +860,7 @@
sysmon_envsys_unregister(struct sysmon_envsys *sme)
{
prop_array_t array;
+ struct sysmon_envsys *osme;
KASSERT(sme != NULL);
@@ -868,11 +869,16 @@
*/
sme_event_unregister_all(sme);
/*
- * Decrement global sensors counter (only used for compatibility
- * with previous API) and remove the device from the list.
+ * Decrement global sensors counter and the first_sensor index
+ * for remaining devices in the list (only used for compatibility
+ * with previous API), and remove the device from the list.
*/
mutex_enter(&sme_global_mtx);
sysmon_envsys_next_sensor_index -= sme->sme_nsensors;
+ LIST_FOREACH(osme, &sysmon_envsys_list, sme_list) {
+ if (osme->sme_fsensor >= sme->sme_fsensor)
+ osme->sme_fsensor -= sme->sme_nsensors;
+ }
LIST_REMOVE(sme, sme_list);
mutex_exit(&sme_global_mtx);
Home |
Main Index |
Thread Index |
Old Index