summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-02-15 11:14:46 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-02-15 11:14:46 +0000
commit1de25cf61875f377333aa5a709a844f94c3e27f6 (patch)
tree1553fc5a82558b95d19c1bb7a99efc9a4baadcfe /sys/kern
parent5ecb6279fce54632f15ae90b409c59b358ec1ed7 (diff)
add sysctl_int_arr() API similar to BSD/OS; ok itojun, deraadt, miod, henning
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sysctl.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index a3cbe801bb6..472d9f645b9 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.100 2004/02/15 02:45:46 tedu Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.101 2004/02/15 11:14:45 markus Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -679,6 +679,26 @@ sysctl_rdint(oldp, oldlenp, newp, val)
}
/*
+ * Array of integer values.
+ */
+int
+sysctl_int_arr(valpp, name, namelen, oldp, oldlenp, newp, newlen)
+ int **valpp;
+ int *name;
+ u_int namelen;
+ void *oldp;
+ size_t *oldlenp;
+ void *newp;
+ size_t newlen;
+{
+ if (namelen > 1)
+ return (ENOTDIR);
+ if (name[0] < 0 || valpp[name[0]] == NULL)
+ return (EOPNOTSUPP);
+ return (sysctl_int(oldp, oldlenp, newp, newlen, valpp[name[0]]));
+}
+
+/*
* Validate parameters and get old / set new parameters
* for an integer-valued sysctl function.
*/