Wolf, Josef <[EMAIL PROTECTED]> wrote:

> I've just checked uClibc.  It uses alloca only when a MMU is available.
> If there's no MMU, it falls back to mmap().

That's a bit of a problem surely as you can't free the mappings later.

> Now I'm somewhat confused.  What's wrong with alloca in the vfork
> context?

The only problem I can think of is that alloca() allocates from the stack, and
with NOMMU-mode you've got a limited stack space and no hope of expanding it
if you don't have enough.

> Maybe the problem is coupled with setjmp implementations
> of vfork?  I found http://gcc.gnu.org/ml/gcc/2005-06/msg01265.html but
> that discusses vfork implementation.  That's a totally different thing
> from exec* implementation since the exec* functions have their own
> stack frames

Using alloca() should just require the function using it to use a frame
pointer.  alloca() allocates simply by subtracting (or adding, depending on
your CPU) from the stack pointer.

> > > > > malloc/free _can_ be safe, too _if_ _exactly_ the malloc'ed 
> > > > > areas are freed.

But how do you call free() after (v)forking?

> > Ugh.  I think that's one of those "not recommended" things.
> 
> You mean the double-vfrok?  I'd consider this to be one of the
> "forbidden" things.

Yes.

David
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to