Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/dev/sysmon pull up 1.1 -> 1.2 (requested by thorpej):



details:   https://anonhg.NetBSD.org/src/rev/102800a00b00
branches:  netbsd-1-5
changeset: 488816:102800a00b00
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Jul 30 18:03:03 2000 +0000

description:
pull up 1.1 -> 1.2 (requested by thorpej):
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 9b98e5375700 -r 102800a00b00 sys/dev/sysmon/sysmon.c
--- a/sys/dev/sysmon/sysmon.c   Sun Jul 30 17:59:40 2000 +0000
+++ b/sys/dev/sysmon/sysmon.c   Sun Jul 30 18:03:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon.c,v 1.2.2.2 2000/07/30 17:54:16 bouyer Exp $    */
+/*     $NetBSD: sysmon.c,v 1.2.2.3 2000/07/30 18:03:03 bouyer 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