summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sysctl.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-04-20 20:49:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-04-20 20:49:37 +0000
commitcd401f6732e8849ebd763413c6d53b1126b61a05 (patch)
tree39f328c491c012082094970eb0ffc6dfe4d07d1f /sys/kern/kern_sysctl.c
parent5afe4381d46759178e7417c854cb9b517bb23955 (diff)
Get rid of MAXSENSORDEVICES. Gaps in sensordev lists are now handled
by returning ENXIO instead of ENOENT, to essentially indicate hotplug sensor that has gone away. Accessing beyond the end of the sensordev list still returns ENOENT, so that you can see there are no further devices. ok kettenis oga
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r--sys/kern/kern_sysctl.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index a446a07e24d..35fe3238fad 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.181 2010/03/24 23:18:17 tedu Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.182 2010/04/20 20:49:33 deraadt Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -2008,9 +2008,9 @@ sysctl_sensors(int *name, u_int namelen, void *oldp, size_t *oldlenp,
dev = name[0];
if (namelen == 1) {
- ksd = sensordev_get(dev);
- if (ksd == NULL)
- return (ENOENT);
+ ret = sensordev_get(dev, &ksd);
+ if (ret)
+ return (ret);
/* Grab a copy, to clear the kernel pointers */
usd = malloc(sizeof(*usd), M_TEMP, M_WAITOK|M_ZERO);
@@ -2029,9 +2029,9 @@ sysctl_sensors(int *name, u_int namelen, void *oldp, size_t *oldlenp,
type = name[1];
numt = name[2];
- ks = sensor_find(dev, type, numt);
- if (ks == NULL)
- return (ENOENT);
+ ret = sensor_find(dev, type, numt, &ks);
+ if (ret)
+ return (ret);
/* Grab a copy, to clear the kernel pointers */
us = malloc(sizeof(*us), M_TEMP, M_WAITOK|M_ZERO);