]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Make a temporary copy of the output data in the generic sysctl handlers
authorDon Lewis <truckman@FreeBSD.org>
Sun, 28 Jul 2002 21:06:14 +0000 (21:06 +0000)
committerDon Lewis <truckman@FreeBSD.org>
Sun, 28 Jul 2002 21:06:14 +0000 (21:06 +0000)
commit9e74cba35aeabacf87cf8182c604907ea36534ea
treedf2d826f50a0e5b2dc5b0895d11b95134c2ba92c
parente43c2eab07cf9eda3387541f3399a4e016f8568f
Make a temporary copy of the output data in the generic sysctl handlers
so that the data is less likely to be inconsistent if SYSCTL_OUT() blocks.
If the data is large, wire the output buffer instead.

This is somewhat less than optimal, since the handler could skip the copy
if it knew that the data was static.

If the data is dynamic, we are still not guaranteed to get a consistent
copy since another processor could change the data while the copy is in
progress because the data is not locked.  This problem could be solved if
the generic handlers had the ability to grab the proper lock before the
copy and release it afterwards.

This may duplicate work done in other sysctl handlers in the kernel which
also copy the data, possibly while a lock is held, before calling they call
a generic handler to output the data.  These handlers should probably call
SYSCTL_OUT() directly.
sys/kern/kern_sysctl.c