[BusyBox] Boggling at tar.c a bit...

Manuel Novoa III mjn3 at codepoet.org
Fri Aug 26 07:35:20 PDT 2005


On Thu, Aug 25, 2005 at 11:39:59PM -0500, Rob Landley wrote:
> What does the #ifdef __gnuc__ bit do?

Looks like it wraps some code to try to prevent gcc from throwing
warnings about unused vars.

> We have a volatile local variable (vfork_exec_errno), which is interacting 
> with vfork in a way that seems unnecessarily subtle.  (Do parent and child 
> really reliably share a stack there?  Why did the threading people need 
> kernel support for thread local storage then?)

Of course they share a stack... the code is using vfork.  Apparently
they wanted the child code to pass back the errno value to the parent
on failure.  Since vfork_exec_errno is modified by the child in the 'if'
block and checked by the parent in the 'else' block, it needs to be
qualified as volatile.

Manuel


More information about the busybox mailing list