summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_sysctl.c22
-rw-r--r--sys/sys/sysctl.h3
2 files changed, 23 insertions, 2 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.
*/
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index c0f4de3119b..a0a326a2582 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.72 2004/02/14 15:09:22 grange Exp $ */
+/* $OpenBSD: sysctl.h,v 1.73 2004/02/15 11:14:45 markus Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -629,6 +629,7 @@ typedef int (sysctlfn)(int *, u_int, void *, size_t *, void *, size_t, struct pr
int sysctl_int(void *, size_t *, void *, size_t, int *);
int sysctl_rdint(void *, size_t *, void *, int);
+int sysctl_int_arr(int **, int *, u_int, void *, size_t *, void *, size_t);
int sysctl_quad(void *, size_t *, void *, size_t, int64_t *);
int sysctl_rdquad(void *, size_t *, void *, int64_t);
int sysctl_string(void *, size_t *, void *, size_t, char *, int);