summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sysctl.c
diff options
context:
space:
mode:
authorroam <roam@FreeBSD.org>2001-07-25 17:21:18 +0000
committerroam <roam@FreeBSD.org>2001-07-25 17:21:18 +0000
commita100af4fa8fb439e081a08bd1feaeee8228d209e (patch)
tree666eb8e043452947c205df448c6ea858d43f5c61 /sys/kern/kern_sysctl.c
parent3e1e624da70d565919479419c126fc463ee9f0d0 (diff)
downloadFreeBSD-src-a100af4fa8fb439e081a08bd1feaeee8228d209e.zip
FreeBSD-src-a100af4fa8fb439e081a08bd1feaeee8228d209e.tar.gz
Make dynamic sysctl entries start at 0x100, not decimal 100 - there are
static entries with oid's over 100, and defining enough dynamic entries causes an overlap. Move the "magic" value 0x100 into <sys/sysctl.h> where it belongs. PR: 29131 Submitted by: "Alexander N. Kabaev" <kabaev@mail.ru> Reviewed by: -arch, -audit MFC after: 2 weeks
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r--sys/kern/kern_sysctl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 0b4c3d4..c165bb3 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -110,15 +110,19 @@ sysctl_register_oid(struct sysctl_oid *oidp)
}
/*
* If this oid has a number OID_AUTO, give it a number which
- * is greater than any current oid. Make sure it is at least
- * 100 to leave space for pre-assigned oid numbers.
+ * is greater than any current oid.
+ * NOTE: DO NOT change the starting value here, change it in
+ * <sys/sysctl.h>, and make sure it is at least 256 to
+ * accomodate e.g. net.inet.raw as a static sysctl node.
*/
if (oidp->oid_number == OID_AUTO) {
- static int newoid = 100;
+ static int newoid = CTL_AUTO_START;
oidp->oid_number = newoid++;
if (newoid == 0x7fffffff)
panic("out of oids");
+ } else if (oidp->oid_number >= CTL_AUTO_START) {
+ panic("static sysctl oid too high: %d", oidp->oid_number);
}
/*
OpenPOWER on IntegriCloud