summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Willem Klok <gwk@cvs.openbsd.org>2006-12-08 23:08:20 +0000
committerGordon Willem Klok <gwk@cvs.openbsd.org>2006-12-08 23:08:20 +0000
commit78a10db8f4e6d808d9fb3fc993ca5d30f6751a18 (patch)
tree3aeb7bae3f9d3522d3a6f9b5a357cd4e318f6053
parent04e88329707cc04e7840da3b0eab51b79cff8227 (diff)
A more permanent solution to setperf methods returning error values and
the higher level sysctl code passing them to userland. Distinct diff from the one I passed around internally with less crazy semantics. Also nuke some trailing spaces in a few places. "just go ahead" deraadt@
-rw-r--r--sys/kern/kern_sysctl.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index d6085b8c3f4..c20974f7f04 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.143 2006/11/29 12:24:17 miod Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.144 2006/12/08 23:08:19 gwk Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -489,7 +489,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
return (EINVAL);
stackgap_random = stackgap;
return (0);
-#if defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM)
+#if defined(SYSVMSG) || defined(SYSVSEM) || defined(SYSVSHM)
case KERN_SYSVIPC_INFO:
return (sysctl_sysvipc(name + 1, namelen - 1, oldp, oldlenp));
#endif
@@ -564,8 +564,7 @@ hw_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
extern char machine[], cpu_model[];
- int err;
- int cpuspeed;
+ int err, cpuspeed;
/* all sysctl names at this level except sensors are terminal */
if (name[0] != HW_SENSORS && namelen != 1)
@@ -627,9 +626,8 @@ hw_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
if (perflevel < 0)
perflevel = 0;
if (newp)
- return (cpu_setperf(perflevel));
- else
- return (0);
+ cpu_setperf(perflevel);
+ return (0);
case HW_VENDOR:
if (hw_vendor)
return (sysctl_rdstring(oldp, oldlenp, newp,
@@ -1713,7 +1711,7 @@ sysctl_sysvipc(int *name, u_int namelen, void *where, size_t *sizep)
buf = malloc(min(tsize, buflen), M_TEMP, M_WAITOK);
bzero(buf, min(tsize, buflen));
- switch (*name) {
+ switch (*name) {
#ifdef SYSVMSG
case KERN_SYSVIPC_MSG_INFO:
msgsi = (struct msg_sysctl_info *)buf;
@@ -1743,7 +1741,7 @@ sysctl_sysvipc(int *name, u_int namelen, void *where, size_t *sizep)
ret = ENOMEM;
break;
}
- switch (*name) {
+ switch (*name) {
#ifdef SYSVMSG
case KERN_SYSVIPC_MSG_INFO:
bcopy(&msqids[i], &msgsi->msgids[i], dssize);