Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sysmon make things boot again, from martin.



details:   https://anonhg.NetBSD.org/src/rev/97f90346f8e6
branches:  trunk
changeset: 337728:97f90346f8e6
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Apr 25 14:06:58 2015 +0000

description:
make things boot again, from martin.

diffstat:

 sys/dev/sysmon/sysmon_envsys.c |  26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diffs (68 lines):

diff -r 00f473e15eb9 -r 97f90346f8e6 sys/dev/sysmon/sysmon_envsys.c
--- a/sys/dev/sysmon/sysmon_envsys.c    Sat Apr 25 14:05:43 2015 +0000
+++ b/sys/dev/sysmon/sysmon_envsys.c    Sat Apr 25 14:06:58 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon_envsys.c,v 1.135 2015/04/25 02:41:42 pgoyette Exp $     */
+/*     $NetBSD: sysmon_envsys.c,v 1.136 2015/04/25 14:06:58 christos 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.135 2015/04/25 02:41:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.136 2015/04/25 14:06:58 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -109,6 +109,20 @@
         NULL, NULL, NULL
 };
 
+static void
+sme_preinit(void)
+{
+       static bool passed = false;
+
+       if (passed)
+               return;
+
+       passed = true;
+       LIST_INIT(&sysmon_envsys_list);
+       mutex_init(&sme_global_mtx, MUTEX_DEFAULT, IPL_NONE);
+       sme_propd = prop_dictionary_create();
+}
+
 /*
  * sysmon_envsys_init:
  *
@@ -119,9 +133,7 @@
 {
        int error;
 
-       LIST_INIT(&sysmon_envsys_list);
-       mutex_init(&sme_global_mtx, MUTEX_DEFAULT, IPL_NONE);
-       sme_propd = prop_dictionary_create();
+       sme_preinit();
 
        error = sysmon_attach_minor(SYSMON_MINOR_ENVSYS, &sysmon_envsys_opvec);
 
@@ -141,6 +153,8 @@
        if (error == 0)
                mutex_destroy(&sme_global_mtx);
 
+       // XXX: prop_dictionary ???
+
        return error;
 }
 
@@ -680,6 +694,8 @@
        KASSERT(sme != NULL);
        KASSERT(sme->sme_name != NULL);
 
+       sme_preinit();
+
        /*
         * Check if requested sysmon_envsys device is valid
         * and does not exist already in the list.



Home | Main Index | Thread Index | Old Index