| Summary: | dynamic sysctl enhancement | ||
|---|---|---|---|
| Product: | Base System | Reporter: | adsharma <adsharma> |
| Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.0-CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
> > Description > >A patch to create dynamic sysctl nodes at runtime Hmm. Do you have suggestions of sample situations where the ability to create dynamic sysctls would be useful? [Be sure to include freebsd-gnats-submit@FreeBSD.org in the Cc of your reply]. On Mon, May 15, 2000 at 11:42:02PM -0400, Tim Vanderhoek wrote: > > > > Description > > > >A patch to create dynamic sysctl nodes at runtime > > Hmm. Do you have suggestions of sample situations where the ability > to create dynamic sysctls would be useful? See http://www.FreeBSD.org/cgi/query-pr.cgi?pr=18524 - specifically sysctl.tar.gz. I want to create one sysctl node for each CPU in the system. This information is available only at runtime. -Arun State Changed From-To: open->closed Dynamic sysctl's have been implemented. |
A patch to create dynamic sysctl nodes at runtime Fix: The following code (and corresponding code for other data types supported by sysctl) needs to go into /usr/src/sys/kern/kern_sysctl.c void sysctl_register_long(struct sysctl_oid_list *parent, int number, char *name, int access, long *ptr, struct sysctl_oid *oidp) { oidp->oid_parent = parent; SLIST_NEXT(oidp, oid_link) = NULL; oidp->oid_number = number; oidp->oid_name = name; oidp->oid_handler = sysctl_handle_long; oidp->oid_kind = CTLTYPE_INT | access; oidp->oid_arg1 = (void *) ptr; oidp->oid_arg2 = 0; oidp->oid_fmt = "L"; /* Register this oid */ sysctl_register_oid(oidp); } How-To-Repeat: N/A