summaryrefslogtreecommitdiff
path: root/sys/dev/sysmon
diff options
context:
space:
mode:
authorpgoyette <pgoyette@NetBSD.org>2012-07-19 13:31:06 +0000
committerpgoyette <pgoyette@NetBSD.org>2012-07-19 13:31:06 +0000
commitb94581ba50fb4c9fcfd465bf4f4705752b7953cf (patch)
tree8e57ed912b6ea00b3e8a5b17e0a7e17de94d484c /sys/dev/sysmon
parent04b08ddde06e1171ff5c874bb755d08e743d4b81 (diff)
Make sure to re-add the sensor as an entropy source after user request
to reset (via envstat -S)
Diffstat (limited to 'sys/dev/sysmon')
-rw-r--r--sys/dev/sysmon/sysmon_envsys.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/sys/dev/sysmon/sysmon_envsys.c b/sys/dev/sysmon/sysmon_envsys.c
index 8a69cde465b..fc3e65c5751 100644
--- a/sys/dev/sysmon/sysmon_envsys.c
+++ b/sys/dev/sysmon/sysmon_envsys.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys.c,v 1.121 2012/07/16 13:55:01 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsys.c,v 1.122 2012/07/19 13:31:06 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.121 2012/07/16 13:55:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.122 2012/07/19 13:31:06 pgoyette Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -1062,6 +1062,7 @@ sme_remove_userprops(void)
prop_dictionary_t sdict;
envsys_data_t *edata = NULL;
char tmp[ENVSYS_DESCLEN];
+ char rnd_name[sizeof(edata->rnd_src.name)];
sysmon_envsys_lim_t lims;
const struct sme_descr_entry *sdt_units;
uint32_t props;
@@ -1168,21 +1169,29 @@ sme_remove_userprops(void)
sme_event_unregister(sme, edata->desc,
PENVSYS_EVENT_LIMITS);
+ /*
+ * Find the correct units for this sensor.
+ */
+ sdt_units = sme_find_table_entry(SME_DESC_UNITS,
+ edata->units);
+
if (props & PROP_LIMITS) {
DPRINTF(("%s: install limits for %s %s\n",
__func__, sme->sme_name, edata->desc));
-
- /*
- * Find the correct units for this sensor.
- */
- sdt_units = sme_find_table_entry(SME_DESC_UNITS,
- edata->units);
-
sme_event_register(sdict, edata, sme,
&lims, props, PENVSYS_EVENT_LIMITS,
sdt_units->crittype);
}
+ if (edata->flags & ENVSYS_FHAS_ENTROPY) {
+ sme_event_register(sdict, edata, sme,
+ &lims, props, PENVSYS_EVENT_NULL,
+ sdt_units->crittype);
+ snprintf(rnd_name, sizeof(rnd_name), "%s-%s",
+ sme->sme_name, edata->desc);
+ rnd_attach_source(&edata->rnd_src, rnd_name,
+ RND_TYPE_ENV, 0);
+ }
}
/*