summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sysctl.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2004-05-23 19:41:24 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2004-05-23 19:41:24 +0000
commitcd05774901156316d9f4092910a5d32b7e8a64d7 (patch)
tree79ce7b67aaafe4ec2209884aad79eaf1205ae40c /sys/kern/kern_sysctl.c
parentc6dc25d23c99899b769c7a094fcf6b17b52c1eaf (diff)
bad stuff escaped by accident
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r--sys/kern/kern_sysctl.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 728bc484fe6..f19f9f63e88 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.107 2004/05/23 19:37:24 tedu Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.108 2004/05/23 19:41:23 tedu Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -525,6 +525,7 @@ hw_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int err;
int cpuspeed;
static int perflevel = 100;
+ int operflevel;
/* all sysctl names at this level except sensors are terminal */
if (name[0] != HW_SENSORS && namelen != 1)
@@ -576,17 +577,17 @@ hw_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
case HW_SETPERF:
if (!cpu_setperf)
return (EOPNOTSUPP);
+ operflevel = perflevel;
err = sysctl_int(oldp, oldlenp, newp, newlen, &perflevel);
if (err)
return err;
+ if (perflevel == operflevel)
+ return (0);
if (perflevel > 100)
perflevel = 100;
if (perflevel < 0)
perflevel = 0;
- if (newp)
- return (cpu_setperf(perflevel));
- else
- return (0);
+ return (cpu_setperf(perflevel));
default:
return (EOPNOTSUPP);
}