Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sysmon Fix a couple of brain-o's in error cases, and...



details:   https://anonhg.NetBSD.org/src/rev/6b5efed8cb50
branches:  trunk
changeset: 493974:6b5efed8cb50
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Jun 28 06:51:17 2000 +0000

description:
Fix a couple of brain-o's in error cases, and use PCATCH for
the sysmon mutex wait.

diffstat:

 sys/dev/sysmon/sysmon.c |  18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diffs (65 lines):

diff -r 9da50fb6f7b7 -r 6b5efed8cb50 sys/dev/sysmon/sysmon.c
--- a/sys/dev/sysmon/sysmon.c   Wed Jun 28 03:32:55 2000 +0000
+++ b/sys/dev/sysmon/sysmon.c   Wed Jun 28 06:51:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon.c,v 1.1 2000/06/24 00:37:20 thorpej Exp $       */
+/*     $NetBSD: sysmon.c,v 1.2 2000/06/28 06:51:17 thorpej Exp $       */
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -82,7 +82,7 @@
 sysmon_init(void)
 {
 
-       lockinit(&sysmon_lock, PWAIT, "sysmon", 0, 0);
+       lockinit(&sysmon_lock, PWAIT|PCATCH, "sysmon", 0, 0);
        sysmon_initialized = 1;
 }
 
@@ -168,6 +168,8 @@
            {
                struct envsys_tre_data *tred = (void *) data;
 
+               tred->validflags = 0;
+
                sme = sysmon_envsys_find(tred->sensor);
                if (sme == NULL)
                        break;
@@ -175,8 +177,6 @@
                tred->sensor = SME_SENSOR_IDX(sme, tred->sensor);
                if (tred->sensor < sme->sme_nsensors)
                        error = (*sme->sme_gtredata)(sme, tred);
-               else
-                       tred->validflags = 0;
                tred->sensor = oidx;
                sysmon_envsys_release(sme);
                break;
@@ -187,6 +187,10 @@
                struct envsys_basic_info *binfo = (void *) data;
 
                sme = sysmon_envsys_find(binfo->sensor);
+               if (sme == NULL) {
+                       binfo->validflags = 0;
+                       break;
+               }
                oidx = binfo->sensor;
                binfo->sensor = SME_SENSOR_IDX(sme, binfo->sensor);
                if (binfo->sensor < sme->sme_nsensors)
@@ -202,13 +206,15 @@
            {
                struct envsys_basic_info *binfo = (void *) data;
 
+               binfo->validflags = 0;
+
                sme = sysmon_envsys_find(binfo->sensor);
+               if (sme == NULL)
+                       break;
                oidx = binfo->sensor;
                binfo->sensor = SME_SENSOR_IDX(sme, binfo->sensor);
                if (binfo->sensor < sme->sme_nsensors)
                        *binfo = sme->sme_sensor_info[binfo->sensor];
-               else
-                       binfo->validflags = 0;
                binfo->sensor = oidx;
                sysmon_envsys_release(sme);
                break;



Home | Main Index | Thread Index | Old Index