Re: Let init know user wants to shutdown

From: Miquel van Smoorenburg (miquels@cistron-office.nl)
Date: Tue Apr 10 2001 - 18:20:24 EST


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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 15 2001 - 21:00:14 EST