Index | Thread | Search

From:
Vitaliy Makkoveev <mvs@openbsd.org>
Subject:
sysctl(2): unlock KERN_CLOCKRATE
To:
tech@openbsd.org
Date:
Mon, 5 Aug 2024 23:40:59 +0300

Download raw body.

Thread
Read-only access to local `clkinfo' filled with immutable `tick', `hz',
`profhz' and `stathz'.

Index: sys/kern/kern_sysctl.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_sysctl.c,v
diff -u -p -r1.433 kern_sysctl.c
--- sys/kern/kern_sysctl.c	5 Aug 2024 18:47:29 -0000	1.433
+++ sys/kern/kern_sysctl.c	5 Aug 2024 20:34:53 -0000
@@ -507,6 +507,8 @@ kern_sysctl(int *name, u_int namelen, vo
 		return (sysctl_rdstring(oldp, oldlenp, newp, version));
 	case KERN_NUMVNODES:  /* XXX numvnodes is a long */
 		return (sysctl_rdint(oldp, oldlenp, newp, numvnodes));
+	case KERN_CLOCKRATE:
+		return (sysctl_clockrate(oldp, oldlenp, newp));
 	case KERN_BOOTTIME: {
 		struct timeval bt;
 		memset(&bt, 0, sizeof bt);
@@ -614,8 +616,6 @@ kern_sysctl_locked(int *name, u_int name
 		error =  sysctl_int(oldp, oldlenp, newp, newlen, &inthostid);
 		hostid = inthostid;
 		return (error);
-	case KERN_CLOCKRATE:
-		return (sysctl_clockrate(oldp, oldlenp, newp));
 	case KERN_MSGBUFSIZE:
 	case KERN_CONSBUFSIZE: {
 		struct msgbuf *mp;