summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2021-05-04 21:57:16 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2021-05-04 21:57:16 +0000
commit6d9f934b389c992a39a3c9a74c1a88f2c966bdf0 (patch)
tree5607dd4adf96921d8b127529f06875de4a6305cd /sys/kern
parentc76a340f1c4f6b735d4f08d15cfab9704cbb6ac2 (diff)
Reorder the integer sysctl functions. Then the traditional 4.4BSD
comment 'As above...' makes sense again. Improve comments for sysctl_int_bounded() and sysctl_bounded_arr(). OK gnezdo@ mvs@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sysctl.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 0ac4a787594..d2069599418 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.393 2021/05/04 19:04:56 bluhm Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.394 2021/05/04 21:57:15 bluhm Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -856,6 +856,27 @@ sysctl_int(void *oldp, size_t *oldlenp, void *newp, size_t newlen, int *valp)
return (error);
}
+/*
+ * As above, but read-only.
+ */
+int
+sysctl_rdint(void *oldp, size_t *oldlenp, void *newp, int val)
+{
+ int error = 0;
+
+ if (oldp && *oldlenp < sizeof(int))
+ return (ENOMEM);
+ if (newp)
+ return (EPERM);
+ *oldlenp = sizeof(int);
+ if (oldp)
+ error = copyout((caddr_t)&val, oldp, sizeof(int));
+ return (error);
+}
+
+/*
+ * Read-only or bounded integer values.
+ */
int
sysctl_int_bounded(void *oldp, size_t *oldlenp, void *newp, size_t newlen,
int *valp, int minimum, int maximum)
@@ -877,25 +898,7 @@ sysctl_int_bounded(void *oldp, size_t *oldlenp, void *newp, size_t newlen,
}
/*
- * As above, but read-only.
- */
-int
-sysctl_rdint(void *oldp, size_t *oldlenp, void *newp, int val)
-{
- int error = 0;
-
- if (oldp && *oldlenp < sizeof(int))
- return (ENOMEM);
- if (newp)
- return (EPERM);
- *oldlenp = sizeof(int);
- if (oldp)
- error = copyout((caddr_t)&val, oldp, sizeof(int));
- return (error);
-}
-
-/*
- * Array of bounded integer values.
+ * Array of read-only or bounded integer values.
*/
int
sysctl_bounded_arr(const struct sysctl_bounded_args *valpp, u_int valplen,