diff options
author | Constantine A. Murenin <cnst@cvs.openbsd.org> | 2007-05-29 02:02:13 +0000 |
---|---|---|
committer | Constantine A. Murenin <cnst@cvs.openbsd.org> | 2007-05-29 02:02:13 +0000 |
commit | 58a580912f38a3e223832989130353a28c1b06cb (patch) | |
tree | ea8d4514eeee41f9a6b5a8a498ddfd74f0578979 /usr.sbin | |
parent | ba34ded03b462b7ce440edfef79fdec941252b5b (diff) |
for sensorsd.conf entries, let's do matching by sensor type if maching by complete sysctl name does not yield anything; ok henning, otto
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sensorsd/sensorsd.c | 37 | ||||
-rw-r--r-- | usr.sbin/sensorsd/sensorsd.conf.5 | 20 |
2 files changed, 36 insertions, 21 deletions
diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c index 32bef5b8951..084c086a85b 100644 --- a/usr.sbin/sensorsd/sensorsd.c +++ b/usr.sbin/sensorsd/sensorsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensorsd.c,v 1.29 2007/02/28 15:28:22 henning Exp $ */ +/* $OpenBSD: sensorsd.c,v 1.30 2007/05/29 02:02:12 cnst Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -414,23 +414,24 @@ parse_config(char *cf) snprintf(node, sizeof(node), "hw.sensors.%s.%s%d", p->dxname, sensor_type_s[p->type], p->numt); if (cgetent(&buf, cfa, node) != 0) - p->watch = 0; - else { - p->watch = 1; - watch_cnt++; - if (cgetstr(buf, "low", &ebuf) < 0) - ebuf = NULL; - p->lower = get_val(ebuf, 0, p->type); - if (cgetstr(buf, "high", &ebuf) < 0) - ebuf = NULL; - p->upper = get_val(ebuf, 1, p->type); - if (cgetstr(buf, "command", &ebuf) < 0) - ebuf = NULL; - if (ebuf) - asprintf(&(p->command), "%s", ebuf); - free(buf); - buf = NULL; - } + if (cgetent(&buf, cfa, sensor_type_s[p->type]) != 0) { + p->watch = 0; + continue; + } + p->watch = 1; + watch_cnt++; + if (cgetstr(buf, "low", &ebuf) < 0) + ebuf = NULL; + p->lower = get_val(ebuf, 0, p->type); + if (cgetstr(buf, "high", &ebuf) < 0) + ebuf = NULL; + p->upper = get_val(ebuf, 1, p->type); + if (cgetstr(buf, "command", &ebuf) < 0) + ebuf = NULL; + if (ebuf) + asprintf(&(p->command), "%s", ebuf); + free(buf); + buf = NULL; } free(cfa); return (watch_cnt); diff --git a/usr.sbin/sensorsd/sensorsd.conf.5 b/usr.sbin/sensorsd/sensorsd.conf.5 index f4334198988..f81e51f2277 100644 --- a/usr.sbin/sensorsd/sensorsd.conf.5 +++ b/usr.sbin/sensorsd/sensorsd.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sensorsd.conf.5,v 1.10 2006/12/28 10:04:27 jmc Exp $ +.\" $OpenBSD: sensorsd.conf.5,v 1.11 2007/05/29 02:02:12 cnst Exp $ .\" .\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org> .\" Copyright (c) 2005 Matthew Gream <matthew.gream@pobox.com> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd March 15, 2005 +.Dd May 28, 2007 .Dt SENSORSD.CONF 5 .Os .Sh NAME @@ -29,7 +29,10 @@ The file is read by .Xr sensorsd 8 to configure hardware sensor monitoring. -Each entry represents one sensor and may specify high and low limits. +Each valid sensor registered in the system +shall be matched by at most one entry in +.Nm , +which may specify high and low limits. If the limits are crossed, .Xr sensorsd 8 's alert functionality is triggered and a command, if specified, is @@ -38,6 +41,17 @@ executed. .Nm follows the syntax of configuration databases as documented in .Xr getcap 3 . +Full +.Va hw.sensors +.Xr sysctl 8 +addresses are used to find entries, +with a fallback on sensor types. +For example, if an entry with a full name of a certain temperature +sensor is not present in +.Nm , +then an entry +.Va temp +will be looked at to determine the limits. The following attributes may be used: .Pp .Bl -tag -width "commandXX" -offset indent -compact |