mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-08 09:30:41 +00:00
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
This commit is contained in:
parent
107e7dc5c3
commit
7ca4d05f34
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=80339
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -95,6 +95,12 @@ struct ctlname {
|
|||
*/
|
||||
#define OID_AUTO (-1)
|
||||
|
||||
/*
|
||||
* The starting number for dynamically-assigned entries. WARNING!
|
||||
* ALL static sysctl entries should have numbers LESS than this!
|
||||
*/
|
||||
#define CTL_AUTO_START 0x100
|
||||
|
||||
#ifdef _KERNEL
|
||||
#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
|
||||
struct sysctl_req *req
|
||||
|
|
Loading…
Reference in a new issue