[PATCH] dropbear-051: uClinux vfork

Mike Frysinger vapier at gentoo.org
Thu Oct 23 16:51:17 WST 2008


On Wednesday 22 October 2008, Rob Landley wrote:
> On Tuesday 21 October 2008 00:01:56 Mike Frysinger wrote:
> > -	if ((pid = fork()) == -1)
> > +#ifdef __uClinux__
> > +	pid = vfork();
> > +#else
> > +	pid = fork();
> > +#endif /* __uClinux__ */
> > +	if (pid == -1)
> >  		fatal("do_local_cmd: fork: %s", strerror(errno));
>
> If it's ever safe to call vfork() from a given place, then it should always
> be safe to call it from that place, so the #ifdef isn't really necessary.
>
> Although vfork() has more restrictive semantics than fork() does, it's not
> really less efficient than doing a fork().  Just less flexible.  A system
> with an mmu can do a vfork() just fine, so if you've cleared that it's ok
> to use it there, there's no real reason for not to just do it all the time.
>  In fact, being consistent means you have a single codepath and the same
> behavior on uClinux as everywhere else.

this is certainly all true ... ive just given up on trying to convince people 
as vfork() tends to scare them.  especially if they dont understand vfork() 
semantics and the app starts behaving in ways they dont recognize.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.ucc.gu.uwa.edu.au/pipermail/dropbear/attachments/20081023/901700f7/attachment.pgp 


More information about the Dropbear mailing list