Subject: Re: SIGPWR not handled by init?
To: Martin Husemann <email@example.com>
From: Garrett D'Amore <firstname.lastname@example.org>
Date: 07/06/2006 15:10:28
Martin Husemann wrote:
> On Thu, Jul 06, 2006 at 02:52:53PM -0700, Garrett D'Amore wrote:
>> I noticed that init on NetBSD doesn't seem to handle SIGPWR reasonably.
>> This is unfortunate, because init could be used to initiate a "safe"
>> shutdown, switching run-states, etc.
> Yes, and the apropriate powerd script can tell it to do so.
> We had a lengthy discussion about this at least once, years ago, and back
> then consensus was to have powerd and it's scripts to be the sole userland
> part responsible for this things.
> I don't see what SIGPWR -> init would gain us.
1) init is _always_ running. so as a fallback when powerd isn't around,
at least init could do something sane
2) any root or kernel thread can easily find and kill -PWR 1. For
powerd to work as well, we would have to add some accessible interface
for userland programs (perhaps just having powerd do the SIGPWR thing,
though then you also have to find the pid for powerd) and it means that
kernel code (right now anyway) has to set up sysmon events for this,
which is a lot more effort than just sending SIGPWR to process 1.
AFAIK, right now powerd doesn't even handle this condition (low power)
at all. It only deals with power button and lidswitch events. So I was
trying to figure out what the correct action would be for me to do when
my power controller is telling it is time to shut down if I care about
Anyway, just wondering.
Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
Phone: 951 325-2134 Fax: 951 325-2191