On Fri, 21 Aug 2009, David Young wrote:
I have been trying to diagnose and fix an obscure bug either in sysctl(9) or in the way that I use it. While I was looking, I found out that it is possible for a sysctlnode to change address if any of its siblings are added or removed, because its parent stores its value, and the value of its siblings, in an array that can be rearranged from time to time. I think that sysctl(9) will be easier to use, and it will save some copying and bookkeeping internally, if parents store pointers to their children instead of the values of their children. Just in case I find time to make that so, let me know if there are complicating factors or downsides that I am overlooking.
There are some games that get played by "helper" functions to which you might need to pay close attention. For example, the "value" that is kept in the sysctl node might actually be simply some sort of cookie that the helper function uses to access the real value.
I used this in the dbcool(4) driver, but can't remember from where I cloned the code.
------------------------------------------------------------------------- | Paul Goyette | PGP DSS Key fingerprint: | E-mail addresses: | | Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com | | Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net | | Kernel Developer | | pgoyette at netbsd.org | -------------------------------------------------------------------------