[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] init.c, halt command not working
From:       Harald_Küthe <harald-tuxbox () arcor ! de>
Date:       2008-03-31 19:59:36
Message-ID: 47F142A8.70805 () arcor ! de
[Download RAW message or body]

Hello,

> On Sunday 30 March 2008 22:46, Harald Küthe wrote:
> > Hello list,
> >
> > (at least) the halt command is no longer working on our system (ppc32,
> > linux-2.4.36)
> > Following patch makes it work again.

> > --- busybox-1.10.0-orig/init/init.c    2008-03-22 02:31:51.000000000 +0100
> > +++ busybox-1.10.0/init/init.c    2008-03-30 22:22:02.000000000 +0200
> > @@ -372,7 +372,7 @@
> >      sigemptyset(&nmask);
> >      sigaddset(&nmask, SIGCHLD);
> >      sigprocmask(SIG_BLOCK, &nmask, &omask);
> > -    pid = vfork();
> > +    pid = BB_MMU ? fork() : vfork();
> >      sigprocmask(SIG_SETMASK, &omask, NULL);
> > 
> >      if (pid < 0)

> Did you debug the reason where it broke if vfork is used?

Not really... I just identified which changes are causing this.

> The sequence of events is:
> SIGUSR1 is received
> halt_reboot_pwoff(SIGUSR1) calls
>  kill_all_processes() calls
>   run_actions(SHUTDOWN):
>                         if (a->action_type & (SYSINIT | WAIT | 
CTRLALTDEL | SHUTDOWN | RESTART)) {
>                                 waitfor(run(a));
>                                 delete_init_action(a);
> run(a) vforks... and this is somehow doesn't work very well

It looks as if SIGUSR1 is !!not!! received because halt_reboot_pwoff()
is not processed.

> Quick test:
> If you simply remove run_actions(SHUTDOWN) in kill_all_processes(),
> does it work now?

no change same as before.

> > @@ -529,7 +529,7 @@
> >      /* We have to fork here, since the kernel calls do_exit(0) in
> >       * linux/kernel/sys.c, which can cause the machine to panic when
> >       * the init process is killed.... */
> > -    pid = vfork();
> > +    pid = BB_MMU ? fork() : vfork();
> >      if (pid == 0) { /* child */
> >          reboot(magic);
> >          _exit(0);

> Does it work without this change? It should...

yes it works

> --
> vda

Note: a call to <killall init> is able to restart the system

Any directions where to dig further?

Best regards
Harald


_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic