anonymous storage and execve()
Matthew Dillon
dillon at apollo.backplane.com
Fri Nov 7 09:34:33 PST 2003
:I've spent the week trying to understand the source for execve() and the
:image activators. I think I'm ready to split execve(). Before I do,
:I have some questions about how I should allocate memory for the separate
:buffers.
:
:The string and image_header buffer is going to be split into a couple of
:pieces. For the strings, I need to create at least two buffers. One
:will be for the arg and env strings at least ARG_MAX in length. Another
:will be for the path name of the executable which should be PATH_MAX in
:length.
:
:In what cases should I be using the kmem allocator versus the slab
:allocator?
:
:--
: David P. Reese, Jr. daver at xxxxxxxxxxxx
: http://www.gomerbud.com/daver/
Normally you would always use the slab allocator but in this instance I
would change as little as possible so I would keep the
'img->stringbase = kmem_alloc...' code that is already there.
The uap being set in imgp is just used as temporary storage, I believe.
It looks like uap is mostly accessed at the beginning of execv() and
in exec_extract_strings() which is called near the beginning of the
image activator.
What I recommend is that you create a new structure for imgp to point
to. e.g. instead of imgp->uap it would be imgp->xuap, and it would be
the job of the syscall code to construct this new structure, call the
kern_exec*() equivalent, and then free it.
-Matt
Matthew Dillon
<dillon at xxxxxxxxxxxxx>
More information about the Kernel
mailing list