Re: Let init know user wants to shutdown

Miquel van Smoorenburg
2001-04-10T23:20:48Z

In article <20010405000215.A599@bug.ucw.cz>,
Pavel Machek <pavel@suse.cz> wrote:
>Hi!
>
>Init should get to know that user pressed power button (so it can do
>shutdown and poweroff). Plus, it is nice to let user know that we can
>read such event. [I hunted bug for few hours, thinking that kernel
>does not get the event at all].
>
>Here's patch to do that. Please apply,

Not so hasty ;)

>+ printk ("acpi: Power button pressed!\n");
>+ kill_proc (1, SIGTERM, 1);

SIGTERM is a bad choise. Right now, init ignores SIGTERM. For
good reason; on some (many?) systems, the shutdown scripts
include "kill -15 -1; sleep 2; kill -9 -1". The "-1" means
"all processes except me". That means init will get hit with
SIGTERM occasionally during shutdown, and that might cause
weird things to happen.

Perhaps SIGUSR1 ?

Mike.