When the user updates the sensor device's refresh timer, reset the callout immediately rather than waiting for the previous timer to expire.diff -r1.111 -r1.112 src/sys/dev/sysmon/sysmon_envsys.c
(pgoyette)
--- src/sys/dev/sysmon/sysmon_envsys.c 2010/12/16 16:08:57 1.111
+++ src/sys/dev/sysmon/sysmon_envsys.c 2010/12/30 03:59:59 1.112
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sysmon_envsys.c,v 1.111 2010/12/16 16:08:57 njoly Exp $ */ | 1 | /* $NetBSD: sysmon_envsys.c,v 1.112 2010/12/30 03:59:59 pgoyette Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007, 2008 Juan Romero Pardines. | 4 | * Copyright (c) 2007, 2008 Juan Romero Pardines. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -54,27 +54,27 @@ | @@ -54,27 +54,27 @@ | |||
54 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 54 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
55 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 55 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
56 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 56 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
57 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 57 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
58 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 58 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
59 | */ | 59 | */ | |
60 | 60 | |||
61 | /* | 61 | /* | |
62 | * Environmental sensor framework for sysmon, exported to userland | 62 | * Environmental sensor framework for sysmon, exported to userland | |
63 | * with proplib(3). | 63 | * with proplib(3). | |
64 | */ | 64 | */ | |
65 | 65 | |||
66 | #include <sys/cdefs.h> | 66 | #include <sys/cdefs.h> | |
67 | __KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.111 2010/12/16 16:08:57 njoly Exp $"); | 67 | __KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.112 2010/12/30 03:59:59 pgoyette Exp $"); | |
68 | 68 | |||
69 | #include <sys/param.h> | 69 | #include <sys/param.h> | |
70 | #include <sys/types.h> | 70 | #include <sys/types.h> | |
71 | #include <sys/conf.h> | 71 | #include <sys/conf.h> | |
72 | #include <sys/errno.h> | 72 | #include <sys/errno.h> | |
73 | #include <sys/fcntl.h> | 73 | #include <sys/fcntl.h> | |
74 | #include <sys/kernel.h> | 74 | #include <sys/kernel.h> | |
75 | #include <sys/systm.h> | 75 | #include <sys/systm.h> | |
76 | #include <sys/proc.h> | 76 | #include <sys/proc.h> | |
77 | #include <sys/mutex.h> | 77 | #include <sys/mutex.h> | |
78 | #include <sys/kmem.h> | 78 | #include <sys/kmem.h> | |
79 | 79 | |||
80 | /* #define ENVSYS_DEBUG */ | 80 | /* #define ENVSYS_DEBUG */ | |
@@ -1165,26 +1165,27 @@ sme_remove_userprops(void) | @@ -1165,26 +1165,27 @@ sme_remove_userprops(void) | |||
1165 | sdt_units = sme_find_table_entry(SME_DESC_UNITS, | 1165 | sdt_units = sme_find_table_entry(SME_DESC_UNITS, | |
1166 | edata->units); | 1166 | edata->units); | |
1167 | 1167 | |||
1168 | sme_event_register(sdict, edata, sme, | 1168 | sme_event_register(sdict, edata, sme, | |
1169 | &lims, props, PENVSYS_EVENT_LIMITS, | 1169 | &lims, props, PENVSYS_EVENT_LIMITS, | |
1170 | sdt_units->crittype); | 1170 | sdt_units->crittype); | |
1171 | } | 1171 | } | |
1172 | } | 1172 | } | |
1173 | 1173 | |||
1174 | /* | 1174 | /* | |
1175 | * Restore default timeout value. | 1175 | * Restore default timeout value. | |
1176 | */ | 1176 | */ | |
1177 | sme->sme_events_timeout = SME_EVENTS_DEFTIMEOUT; | 1177 | sme->sme_events_timeout = SME_EVENTS_DEFTIMEOUT; | |
1178 | sme_schedule_callout(sme); | |||
1178 | sysmon_envsys_release(sme, false); | 1179 | sysmon_envsys_release(sme, false); | |
1179 | } | 1180 | } | |
1180 | mutex_exit(&sme_global_mtx); | 1181 | mutex_exit(&sme_global_mtx); | |
1181 | } | 1182 | } | |
1182 | 1183 | |||
1183 | /* | 1184 | /* | |
1184 | * sme_add_property_dictionary: | 1185 | * sme_add_property_dictionary: | |
1185 | * | 1186 | * | |
1186 | * + Add global properties into a device. | 1187 | * + Add global properties into a device. | |
1187 | */ | 1188 | */ | |
1188 | static int | 1189 | static int | |
1189 | sme_add_property_dictionary(struct sysmon_envsys *sme, prop_array_t array, | 1190 | sme_add_property_dictionary(struct sysmon_envsys *sme, prop_array_t array, | |
1190 | prop_dictionary_t dict) | 1191 | prop_dictionary_t dict) | |
@@ -1204,28 +1205,30 @@ sme_add_property_dictionary(struct sysmo | @@ -1204,28 +1205,30 @@ sme_add_property_dictionary(struct sysmo | |||
1204 | * ... | 1205 | * ... | |
1205 | * <dict> | 1206 | * <dict> | |
1206 | * <key>device-properties</key> | 1207 | * <key>device-properties</key> | |
1207 | * <dict> | 1208 | * <dict> | |
1208 | * <key>refresh-timeout</key> | 1209 | * <key>refresh-timeout</key> | |
1209 | * <integer>120</integer< | 1210 | * <integer>120</integer< | |
1210 | * <key>device-class</key> | 1211 | * <key>device-class</key> | |
1211 | * <string>class_name</string> | 1212 | * <string>class_name</string> | |
1212 | * </dict> | 1213 | * </dict> | |
1213 | * </dict> | 1214 | * </dict> | |
1214 | * ... | 1215 | * ... | |
1215 | * | 1216 | * | |
1216 | */ | 1217 | */ | |
1217 | if (!sme->sme_events_timeout) | 1218 | if (sme->sme_events_timeout == 0) { | |
1218 | sme->sme_events_timeout = SME_EVENTS_DEFTIMEOUT; | 1219 | sme->sme_events_timeout = SME_EVENTS_DEFTIMEOUT; | |
1220 | sme_schedule_callout(sme); | |||
1221 | } | |||
1219 | 1222 | |||
1220 | if (!prop_dictionary_set_uint64(pdict, "refresh-timeout", | 1223 | if (!prop_dictionary_set_uint64(pdict, "refresh-timeout", | |
1221 | sme->sme_events_timeout)) { | 1224 | sme->sme_events_timeout)) { | |
1222 | error = EINVAL; | 1225 | error = EINVAL; | |
1223 | goto out; | 1226 | goto out; | |
1224 | } | 1227 | } | |
1225 | if (sme->sme_class == SME_CLASS_BATTERY) | 1228 | if (sme->sme_class == SME_CLASS_BATTERY) | |
1226 | class = "battery"; | 1229 | class = "battery"; | |
1227 | else if (sme->sme_class == SME_CLASS_ACADAPTER) | 1230 | else if (sme->sme_class == SME_CLASS_ACADAPTER) | |
1228 | class = "ac-adapter"; | 1231 | class = "ac-adapter"; | |
1229 | else | 1232 | else | |
1230 | class = "other"; | 1233 | class = "other"; | |
1231 | if (!prop_dictionary_set_cstring_nocopy(pdict, "device-class", class)) { | 1234 | if (!prop_dictionary_set_cstring_nocopy(pdict, "device-class", class)) { | |
@@ -1795,27 +1798,30 @@ sme_userset_dictionary(struct sysmon_env | @@ -1795,27 +1798,30 @@ sme_userset_dictionary(struct sysmon_env | |||
1795 | if (obj && prop_object_type(obj) == PROP_TYPE_DICTIONARY) { | 1798 | if (obj && prop_object_type(obj) == PROP_TYPE_DICTIONARY) { | |
1796 | /* | 1799 | /* | |
1797 | * Get the 'refresh-timeout' property for this device. | 1800 | * Get the 'refresh-timeout' property for this device. | |
1798 | */ | 1801 | */ | |
1799 | obj1 = prop_dictionary_get(obj, "refresh-timeout"); | 1802 | obj1 = prop_dictionary_get(obj, "refresh-timeout"); | |
1800 | if (obj1 && prop_object_type(obj1) == PROP_TYPE_NUMBER) { | 1803 | if (obj1 && prop_object_type(obj1) == PROP_TYPE_NUMBER) { | |
1801 | targetfound = true; | 1804 | targetfound = true; | |
1802 | refresh_timo = | 1805 | refresh_timo = | |
1803 | prop_number_unsigned_integer_value(obj1); | 1806 | prop_number_unsigned_integer_value(obj1); | |
1804 | if (refresh_timo < 1) | 1807 | if (refresh_timo < 1) | |
1805 | error = EINVAL; | 1808 | error = EINVAL; | |
1806 | else { | 1809 | else { | |
1807 | mutex_enter(&sme->sme_mtx); | 1810 | mutex_enter(&sme->sme_mtx); | |
1808 | sme->sme_events_timeout = refresh_timo; | 1811 | if (sme->sme_events_timeout != refresh_timo) { | |
1812 | sme->sme_events_timeout = refresh_timo; | |||
1813 | sme_schedule_callout(sme); | |||
1814 | } | |||
1809 | mutex_exit(&sme->sme_mtx); | 1815 | mutex_exit(&sme->sme_mtx); | |
1810 | } | 1816 | } | |
1811 | } | 1817 | } | |
1812 | return error; | 1818 | return error; | |
1813 | 1819 | |||
1814 | } else if (!obj) { | 1820 | } else if (!obj) { | |
1815 | /* | 1821 | /* | |
1816 | * Get sensor's index from userland dictionary. | 1822 | * Get sensor's index from userland dictionary. | |
1817 | */ | 1823 | */ | |
1818 | obj = prop_dictionary_get(udict, "index"); | 1824 | obj = prop_dictionary_get(udict, "index"); | |
1819 | if (!obj) | 1825 | if (!obj) | |
1820 | return EINVAL; | 1826 | return EINVAL; | |
1821 | if (prop_object_type(obj) != PROP_TYPE_STRING) { | 1827 | if (prop_object_type(obj) != PROP_TYPE_STRING) { |
--- src/sys/dev/sysmon/sysmon_envsys_events.c 2010/12/15 17:17:17 1.96
+++ src/sys/dev/sysmon/sysmon_envsys_events.c 2010/12/30 03:59:59 1.97
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sysmon_envsys_events.c,v 1.96 2010/12/15 17:17:17 pgoyette Exp $ */ | 1 | /* $NetBSD: sysmon_envsys_events.c,v 1.97 2010/12/30 03:59:59 pgoyette Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007, 2008 Juan Romero Pardines. | 4 | * Copyright (c) 2007, 2008 Juan Romero Pardines. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 | */ | 26 | */ | |
27 | 27 | |||
28 | /* | 28 | /* | |
29 | * sysmon_envsys(9) events framework. | 29 | * sysmon_envsys(9) events framework. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.96 2010/12/15 17:17:17 pgoyette Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.97 2010/12/30 03:59:59 pgoyette Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/types.h> | 36 | #include <sys/types.h> | |
37 | #include <sys/conf.h> | 37 | #include <sys/conf.h> | |
38 | #include <sys/errno.h> | 38 | #include <sys/errno.h> | |
39 | #include <sys/kernel.h> | 39 | #include <sys/kernel.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/proc.h> | 41 | #include <sys/proc.h> | |
42 | #include <sys/mutex.h> | 42 | #include <sys/mutex.h> | |
43 | #include <sys/kmem.h> | 43 | #include <sys/kmem.h> | |
44 | #include <sys/callout.h> | 44 | #include <sys/callout.h> | |
45 | 45 | |||
46 | /* #define ENVSYS_DEBUG */ | 46 | /* #define ENVSYS_DEBUG */ | |
@@ -476,53 +476,71 @@ do { \ | @@ -476,53 +476,71 @@ do { \ | |||
476 | */ | 476 | */ | |
477 | kmem_free(sed_t, sizeof(*sed_t)); | 477 | kmem_free(sed_t, sizeof(*sed_t)); | |
478 | } | 478 | } | |
479 | 479 | |||
480 | /* | 480 | /* | |
481 | * sme_events_init: | 481 | * sme_events_init: | |
482 | * | 482 | * | |
483 | * + Initialize the events framework for this device. | 483 | * + Initialize the events framework for this device. | |
484 | */ | 484 | */ | |
485 | int | 485 | int | |
486 | sme_events_init(struct sysmon_envsys *sme) | 486 | sme_events_init(struct sysmon_envsys *sme) | |
487 | { | 487 | { | |
488 | int error = 0; | 488 | int error = 0; | |
489 | uint64_t timo; | |||
490 | 489 | |||
491 | KASSERT(sme != NULL); | 490 | KASSERT(sme != NULL); | |
492 | KASSERT(mutex_owned(&sme->sme_mtx)); | 491 | KASSERT(mutex_owned(&sme->sme_mtx)); | |
493 | 492 | |||
494 | if (sme->sme_events_timeout) | |||
495 | timo = sme->sme_events_timeout * hz; | |||
496 | else | |||
497 | timo = SME_EVTIMO; | |||
498 | ||||
499 | error = workqueue_create(&sme->sme_wq, sme->sme_name, | 493 | error = workqueue_create(&sme->sme_wq, sme->sme_name, | |
500 | sme_events_worker, sme, PRI_NONE, IPL_SOFTCLOCK, WQ_MPSAFE); | 494 | sme_events_worker, sme, PRI_NONE, IPL_SOFTCLOCK, WQ_MPSAFE); | |
501 | if (error) | 495 | if (error) | |
502 | return error; | 496 | return error; | |
503 | 497 | |||
504 | mutex_init(&sme->sme_callout_mtx, MUTEX_DEFAULT, IPL_SOFTCLOCK); | 498 | mutex_init(&sme->sme_callout_mtx, MUTEX_DEFAULT, IPL_SOFTCLOCK); | |
505 | callout_init(&sme->sme_callout, CALLOUT_MPSAFE); | 499 | callout_init(&sme->sme_callout, CALLOUT_MPSAFE); | |
506 | callout_setfunc(&sme->sme_callout, sme_events_check, sme); | 500 | callout_setfunc(&sme->sme_callout, sme_events_check, sme); | |
507 | callout_schedule(&sme->sme_callout, timo); | |||
508 | sme->sme_flags |= SME_CALLOUT_INITIALIZED; | 501 | sme->sme_flags |= SME_CALLOUT_INITIALIZED; | |
502 | sme_schedule_callout(sme); | |||
509 | DPRINTF(("%s: events framework initialized for '%s'\n", | 503 | DPRINTF(("%s: events framework initialized for '%s'\n", | |
510 | __func__, sme->sme_name)); | 504 | __func__, sme->sme_name)); | |
511 | 505 | |||
512 | return error; | 506 | return error; | |
513 | } | 507 | } | |
514 | 508 | |||
515 | /* | 509 | /* | |
510 | * sme_schedule_callout | |||
511 | * | |||
512 | * (Re)-schedule the device's callout timer | |||
513 | */ | |||
514 | void | |||
515 | sme_schedule_callout(struct sysmon_envsys *sme) | |||
516 | { | |||
517 | uint64_t timo; | |||
518 | ||||
519 | KASSERT(sme != NULL); | |||
520 | ||||
521 | if ((sme->sme_flags & SME_CALLOUT_INITIALIZED) == 0) | |||
522 | return; | |||
523 | ||||
524 | if (sme->sme_events_timeout) | |||
525 | timo = sme->sme_events_timeout * hz; | |||
526 | else | |||
527 | timo = SME_EVTIMO; | |||
528 | ||||
529 | callout_stop(&sme->sme_callout); | |||
530 | callout_schedule(&sme->sme_callout, timo); | |||
531 | } | |||
532 | ||||
533 | /* | |||
516 | * sme_events_destroy: | 534 | * sme_events_destroy: | |
517 | * | 535 | * | |
518 | * + Destroys the event framework for this device: callout | 536 | * + Destroys the event framework for this device: callout | |
519 | * stopped, workqueue destroyed and callout mutex destroyed. | 537 | * stopped, workqueue destroyed and callout mutex destroyed. | |
520 | */ | 538 | */ | |
521 | void | 539 | void | |
522 | sme_events_destroy(struct sysmon_envsys *sme) | 540 | sme_events_destroy(struct sysmon_envsys *sme) | |
523 | { | 541 | { | |
524 | KASSERT(mutex_owned(&sme->sme_mtx)); | 542 | KASSERT(mutex_owned(&sme->sme_mtx)); | |
525 | 543 | |||
526 | callout_stop(&sme->sme_callout); | 544 | callout_stop(&sme->sme_callout); | |
527 | workqueue_destroy(sme->sme_wq); | 545 | workqueue_destroy(sme->sme_wq); | |
528 | mutex_destroy(&sme->sme_callout_mtx); | 546 | mutex_destroy(&sme->sme_callout_mtx); | |
@@ -620,27 +638,27 @@ sme_events_check(void *arg) | @@ -620,27 +638,27 @@ sme_events_check(void *arg) | |||
620 | 638 | |||
621 | KASSERT(sme != NULL); | 639 | KASSERT(sme != NULL); | |
622 | 640 | |||
623 | mutex_enter(&sme->sme_callout_mtx); | 641 | mutex_enter(&sme->sme_callout_mtx); | |
624 | LIST_FOREACH(see, &sme->sme_events_list, see_list) { | 642 | LIST_FOREACH(see, &sme->sme_events_list, see_list) { | |
625 | workqueue_enqueue(sme->sme_wq, &see->see_wk, NULL); | 643 | workqueue_enqueue(sme->sme_wq, &see->see_wk, NULL); | |
626 | see->see_edata->flags |= ENVSYS_FNEED_REFRESH; | 644 | see->see_edata->flags |= ENVSYS_FNEED_REFRESH; | |
627 | } | 645 | } | |
628 | if (sme->sme_events_timeout) | 646 | if (sme->sme_events_timeout) | |
629 | timo = sme->sme_events_timeout * hz; | 647 | timo = sme->sme_events_timeout * hz; | |
630 | else | 648 | else | |
631 | timo = SME_EVTIMO; | 649 | timo = SME_EVTIMO; | |
632 | if (!sysmon_low_power) | 650 | if (!sysmon_low_power) | |
633 | callout_schedule(&sme->sme_callout, timo); | 651 | sme_schedule_callout(sme); | |
634 | mutex_exit(&sme->sme_callout_mtx); | 652 | mutex_exit(&sme->sme_callout_mtx); | |
635 | } | 653 | } | |
636 | 654 | |||
637 | /* | 655 | /* | |
638 | * sme_events_worker: | 656 | * sme_events_worker: | |
639 | * | 657 | * | |
640 | * + workqueue thread that checks if there's a critical condition | 658 | * + workqueue thread that checks if there's a critical condition | |
641 | * and sends an event if it was triggered. | 659 | * and sends an event if it was triggered. | |
642 | */ | 660 | */ | |
643 | void | 661 | void | |
644 | sme_events_worker(struct work *wk, void *arg) | 662 | sme_events_worker(struct work *wk, void *arg) | |
645 | { | 663 | { | |
646 | sme_event_t *see = (void *)wk; | 664 | sme_event_t *see = (void *)wk; |
--- src/sys/dev/sysmon/sysmon_envsysvar.h 2010/12/15 17:17:17 1.37
+++ src/sys/dev/sysmon/sysmon_envsysvar.h 2010/12/30 03:59:59 1.38
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: sysmon_envsysvar.h,v 1.37 2010/12/15 17:17:17 pgoyette Exp $ */ | 1 | /* $NetBSD: sysmon_envsysvar.h,v 1.38 2010/12/30 03:59:59 pgoyette Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007, 2008 Juan Romero Pardines. | 4 | * Copyright (c) 2007, 2008 Juan Romero Pardines. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -123,25 +123,26 @@ void sysmon_envsys_release(struct sysmon | @@ -123,25 +123,26 @@ void sysmon_envsys_release(struct sysmon | |||
123 | */ | 123 | */ | |
124 | int sme_event_register(prop_dictionary_t, envsys_data_t *, | 124 | int sme_event_register(prop_dictionary_t, envsys_data_t *, | |
125 | struct sysmon_envsys *, sysmon_envsys_lim_t *, | 125 | struct sysmon_envsys *, sysmon_envsys_lim_t *, | |
126 | uint32_t, int, int); | 126 | uint32_t, int, int); | |
127 | int sme_event_unregister(struct sysmon_envsys *, const char *, int); | 127 | int sme_event_unregister(struct sysmon_envsys *, const char *, int); | |
128 | void sme_event_unregister_all(struct sysmon_envsys *); | 128 | void sme_event_unregister_all(struct sysmon_envsys *); | |
129 | void sme_event_drvadd(void *); | 129 | void sme_event_drvadd(void *); | |
130 | int sme_events_init(struct sysmon_envsys *); | 130 | int sme_events_init(struct sysmon_envsys *); | |
131 | void sme_events_destroy(struct sysmon_envsys *); | 131 | void sme_events_destroy(struct sysmon_envsys *); | |
132 | void sme_events_check(void *); | 132 | void sme_events_check(void *); | |
133 | void sme_events_worker(struct work *, void *); | 133 | void sme_events_worker(struct work *, void *); | |
134 | void sme_deliver_event(sme_event_t *); | 134 | void sme_deliver_event(sme_event_t *); | |
135 | int sme_update_limits(struct sysmon_envsys *, envsys_data_t *); | 135 | int sme_update_limits(struct sysmon_envsys *, envsys_data_t *); | |
136 | void sme_schedule_callout(struct sysmon_envsys *); | |||
136 | 137 | |||
137 | /* | 138 | /* | |
138 | * common functions to create/update objects in a dictionary. | 139 | * common functions to create/update objects in a dictionary. | |
139 | */ | 140 | */ | |
140 | int sme_sensor_upbool(prop_dictionary_t, const char *, bool); | 141 | int sme_sensor_upbool(prop_dictionary_t, const char *, bool); | |
141 | int sme_sensor_upint32(prop_dictionary_t, const char *, int32_t); | 142 | int sme_sensor_upint32(prop_dictionary_t, const char *, int32_t); | |
142 | int sme_sensor_upuint32(prop_dictionary_t, const char *, uint32_t); | 143 | int sme_sensor_upuint32(prop_dictionary_t, const char *, uint32_t); | |
143 | int sme_sensor_upstring(prop_dictionary_t, const char *, const char *); | 144 | int sme_sensor_upstring(prop_dictionary_t, const char *, const char *); | |
144 | 145 | |||
145 | const struct sme_descr_entry *sme_find_table_entry(enum sme_descr_type, int); | 146 | const struct sme_descr_entry *sme_find_table_entry(enum sme_descr_type, int); | |
146 | 147 | |||
147 | #endif /* _DEV_SYSMON_ENVSYSVAR_H_ */ | 148 | #endif /* _DEV_SYSMON_ENVSYSVAR_H_ */ |