splitting sysctl

David P. Reese, Jr. daver at gomerbud.com
Thu Oct 30 00:55:06 PST 2003


There are a number of COMPAT_43 syscalls that use userland_sysctl().
I'm trying to figure out if it is possible to do a clean split for
sysctl() without requiring too many copies.

Currently, the sysctl code allows the sysctl_req structure to be
populated with oldfunc() and newfunc() members that move the actual
data back and fourth.  We can choose to move data to and from userland
by using the userland versions of these functions or we can move data
within the kernel by using the kernel space versions.

I'd like to move all of the copyin()/copyout() work out of the sysctl
internals.  To do so without using an excessive amount of copies
kern_sysctl() could return a pointer to the actual data in the MIB
tree.  Thus, a call to __sysctl() that returns a large string or
a big chunk of opaque data to userland only has to a single copy.

The only problem with this approach is that the client function has
to be careful not to modify which is pointed to.  Is this drawback
tollerable?

-- 
   David P. Reese, Jr.                                     daver at xxxxxxxxxxxx
                                               http://www.gomerbud.com/daver/





More information about the Kernel mailing list