summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2004-06-05 11:39:05 +0000
committermux <mux@FreeBSD.org>2004-06-05 11:39:05 +0000
commitb7f9b2983e1f5e9a5bc18a910c2ee42f30adff60 (patch)
treee05c7ad4fdc7b9f7f6458628f055121b63cadf4d /sys/kern
parent3f808f2fddbfe4e27c48febce7ba604d3867b99c (diff)
downloadFreeBSD-src-b7f9b2983e1f5e9a5bc18a910c2ee42f30adff60.zip
FreeBSD-src-b7f9b2983e1f5e9a5bc18a910c2ee42f30adff60.tar.gz
When we don't have any meaningful value to print for the device sysctl
tree, output an empty string instead of "?". This is already what happened with DEVICE_SYSCTL_LOCATION and DEVICE_SYSCTL_PNPINFO. This makes the output of "sysctl dev" much nicer (it won't display those empty sysctls). Reviewed by: des
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_bus.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index e997897..b0271f9 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -210,13 +210,11 @@ devclass_sysctl_handler(SYSCTL_HANDLER_ARGS)
buf = NULL;
switch (arg2) {
case DEVCLASS_SYSCTL_PARENT:
- value = dc->parent ? dc->parent->name : NULL;
+ value = dc->parent ? dc->parent->name : "";
break;
default:
return (EINVAL);
}
- if (value == NULL)
- value = "?";
error = SYSCTL_OUT(req, value, strlen(value));
if (buf != NULL)
free(buf, M_BUS);
@@ -258,10 +256,10 @@ device_sysctl_handler(SYSCTL_HANDLER_ARGS)
buf = NULL;
switch (arg2) {
case DEVICE_SYSCTL_DESC:
- value = dev->desc;
+ value = dev->desc ? dev->desc : "";
break;
case DEVICE_SYSCTL_DRIVER:
- value = dev->driver ? dev->driver->name : NULL;
+ value = dev->driver ? dev->driver->name : "";
break;
case DEVICE_SYSCTL_LOCATION:
value = buf = malloc(1024, M_BUS, M_WAITOK | M_ZERO);
@@ -272,13 +270,11 @@ device_sysctl_handler(SYSCTL_HANDLER_ARGS)
bus_child_pnpinfo_str(dev, buf, 1024);
break;
case DEVICE_SYSCTL_PARENT:
- value = dev->parent ? dev->parent->nameunit : NULL;
+ value = dev->parent ? dev->parent->nameunit : "";
break;
default:
return (EINVAL);
}
- if (value == NULL)
- value = "?";
error = SYSCTL_OUT(req, value, strlen(value));
if (buf != NULL)
free(buf, M_BUS);
OpenPOWER on IntegriCloud