[PATCH] Fix start-stop-daemon on no-MMU

Denis Vlasenko vda.linux at googlemail.com
Wed Aug 1 22:49:19 UTC 2007


On Tuesday 24 July 2007 10:54, Alex Landau wrote:
> Hi,
> 
> The attached patch fixes a compilation error:
>    undefined reference to `_BUG_bb_daemonize_is_unavailable_on_nommu
> and makes start-stop-daemon usable on no-MMU by using bb_daemonize only if BB_MMU and
> emulating it if !BB_MMU.
> 
> This is a bit hackish, since after vfork(), the child does all the work and exec()s the
> daemon, rather than execing right away, as the vfork paradigma says. Still I think this
> is better than re-execing start-stop-daemon and only then execing the daemon itself since
> this approach requires removing the -b (or --background) arguments from the command line,
> which is not fun (what if there are several -b options? etc.),

For the record: no, you don't need that. You can just re-exec with entire
command line intact. -b option will be seen again, and re-exec will be
seemingly done again... but second re-exec will actually NOT be done
because of this:

void forkexit_or_rexec(char **argv)
{
        pid_t pid;
        /* Maybe we are already re-execed and come here again? */
        if (re_execed)     <===================
                return;    <===================

The magic is in re_execed variable. grep for it.

BTW does current svn work for you?
--
vda



More information about the busybox mailing list