Adam Mallory <amalloryNOSPAM@nospamqnx.com> wrote:
This logic applies to SIGPWR also - the signal doesn’t tell you what type of
power failure is causing it (UPS, power flip etc), nor does it tell you that
every process is being terminated - in fact SIGPWR says nothing about
If power is going away, it really doesn’t matter WHY. If power is going away
then all processes will die, there is no other option once the power is gone.
What we are saying is that SIGPWR tells an app that the system is going down
RSN. It does not tell the app what the value of NOW is (ie. 10 seconds, 20
You’re debating the results of the signal which is process specific. I’m
saying that SIGPWR shouldn’t be used to tell a process to terminate nice and
Neither are we.
We are saying that if a shutdown hits processes with SIGTERM, that it’s not
the same as hitting them with SIGPWR. If you hit them with SIGPWR then the
app can decide what to do, with SIGTERM it can’t really do that (short of
perhaps a clean termination).
This is why we want SIGPWR to be generated by the shutdown command, and not
SIGTERM. We want to be able to code apps that respond appropriately to the
impending death of the system (due to power loss) rather than just being asked
These are two seperate problems - if the UPS goes on reserve power, the last
thing you want to do is shut down everything. You’d want to tell any
I never said that the UPS monitoring software would generate SIGPWR when
it went on reserve power. I only said that it might choose to. The point
is that SIGPWR would not neccisarily terminate all apps, but SIGTERM would.
threshold would you want to initiate a full system shutdown. So there is a
world of different between the shutdown command and a UPS (and associated
driver which sends the SIGPWR to the processes).
What UPS software does while on reserve power, yes. What it does when it
determines that it must power down the system is different. In that case it
would simply invoke the shutdown mechanism in the system (and that would send
Most software will indicate many changes in UPS status - from
voltage/current changes to battery level. If UPS software wants to trigger
a orderly shutdown, it sends a SIGTERM. Since SIGPWR should have already
been sent to processes indicating that we’re on reserve power, you can infer
that a SIGTERM while on reserve power is a termination request for power
Geez, this is what we’ve been saying all along. SIGPWR lets an app make a
proper decision on what to do, and SIGTERM doesn not.
I disagree with you in that UPS software would have to generate SIGTERM.
If you look at most *nix systems, it’s way freaking more complicated than
that, and typically involves potentially complex shutdown scripts.
(i.e. files in /etc/init.d or /etc/rc.d all take a paramater that is one
of start, stop, or restart).
Lets use hockey as a better way to show what I think the two signals should
mean to an app.
SIGTERM - buzzer at the end of a period
SIGPWR - entering sudden death overtime
You will note that SIGPWR does not imply the end of the period explicitly,
although it does imply that it could happen any time.
This too was also mentioned in a previous post - I said that a command line
option to change the signal sent would be a trivial change.
I would vote for that as an end to this debate.