On Wed, Aug 17, 2011 at 11:43:54PM +1000, Joel Sing wrote: > According to the sysctl(3) man page, calling sysctl with a NULL value for > oldp should result in the current size being returned.
Hm, it also says when ENOMEM is returned, that we'll fill in as much data as possible, which doesn't seem to actually be true for a lot of the sysctl_*(9) methods. Do we really need sysctl_tstring(), or can we switch everything to just use sysctl_string() instead? Returning a truncated string seems useless, and the way it's currently implemented introduces a race condition: an interrupt might trigger and access the string, or copyout(9) might sleep and then other process-context code might run and look at the code.
