summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2004-02-10 19:53:35 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2004-02-10 19:53:35 +0000
commit60449732b14cef9a6cc7a433a8b2d79727e0942b (patch)
tree74deee6b8178775f28a059de35c55f7f84d74007
parentf1b45d69045e1c244ea9de132f4750c55453edc3 (diff)
Add flags field to the sensor structure and an only flag SENSOR_FINVALID
which allows to drop information from broken, unwired, disabled, etc sensors. ok hshoexer@
-rw-r--r--sbin/sysctl/sysctl.c6
-rw-r--r--sys/sys/sensors.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 283bc1e6886..81c0751563e 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.108 2004/02/10 03:52:53 millert Exp $ */
+/* $OpenBSD: sysctl.c,v 1.109 2004/02/10 19:53:33 grange Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95";
#else
-static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.108 2004/02/10 03:52:53 millert Exp $";
+static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.109 2004/02/10 19:53:33 grange Exp $";
#endif
#endif /* not lint */
@@ -888,7 +888,7 @@ parse(char *string, int flags)
if (special & SENSORS) {
struct sensor *s = (struct sensor *)buf;
- if (size > 0) {
+ if (size > 0 && (s->flags & SENSOR_FINVALID) == 0) {
if (!nflag)
printf("%s%s", string, equ);
printf("%s, %s, ", s->device, s->desc);
diff --git a/sys/sys/sensors.h b/sys/sys/sensors.h
index 0c6bd451ee7..152e4c17d80 100644
--- a/sys/sys/sensors.h
+++ b/sys/sys/sensors.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensors.h,v 1.3 2004/02/07 18:20:22 grange Exp $ */
+/* $OpenBSD: sensors.h,v 1.4 2004/02/10 19:53:34 grange Exp $ */
/*
* Copyright (c) 2003, 2004 Alexander Yurchenko <grange@openbsd.org>
@@ -52,6 +52,8 @@ struct sensor {
char desc[32]; /* sensor description */
int64_t value; /* current value */
u_int rfact; /* resistor factor */
+ int flags; /* sensor flags */
+#define SENSOR_FINVALID 0x0001 /* sensor is invalid */
};
SLIST_HEAD(sensors_head, sensor);