Module Name: src
Committed By: christos
Date: Sat Apr 25 14:06:58 UTC 2015
Modified Files:
src/sys/dev/sysmon: sysmon_envsys.c
Log Message:
make things boot again, from martin.
To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/dev/sysmon/sysmon_envsys.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.135 src/sys/dev/sysmon/sysmon_envsys.c:1.136
--- src/sys/dev/sysmon/sysmon_envsys.c:1.135 Fri Apr 24 22:41:42 2015
+++ src/sys/dev/sysmon/sysmon_envsys.c Sat Apr 25 10:06:58 2015
@@ -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 @@ static struct sysmon_opvec sysmon_envsys
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 @@ sysmon_envsys_init(void)
{
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 @@ sysmon_envsys_fini(void)
if (error == 0)
mutex_destroy(&sme_global_mtx);
+ // XXX: prop_dictionary ???
+
return error;
}
@@ -680,6 +694,8 @@ sysmon_envsys_register(struct sysmon_env
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.