Title |
QNX4: SIGTERM, SIGPWR and the shutdown command |
Ref. No. |
QNX.000010306 |
Category(ies) |
Kernel |
Issue |
An explanation of SIGTERM, SIGPWR and the shutdown command. |
Solution |
SIGTERM and SIGPWR have nothing to do with the hardware. Both of them are signals -- a method of inter-process communication. By default, the kill or slay utility will send a SIGTERM if you tell them to "kill" a process. The default behaviour for any process when hit by a signal is for the process to terminate -- but this can be overridden (in advance) by the process using library routines like signal() or sigaction(). SIGPWR is another signal, it has the standard meaning of "power is going to go away on this box soon", and it is sent by Proc32 to all process on a machine when Proc32 is told to shutdown. The processes that receive the SIGPWR may choose to handle it as they wish -- Fsys would try to flush all its buffers to disk for instance. Most processes will just die, the default behaviour.
The shutdown utility sends a message to Proc32 telling it that the system is about to be shutdown, at which point Proc32 delivers a SIGPWR to all running processes on the machine. shutdown then counts down seconds (by default 10, but if -f is used, it will count down only 2 seconds), after which it sends Proc32 another message, telling Proc32 to shut down the computer now. Proc32 will, then, attempt to shutdown the computer.
There are (at least) 3 different ways to shutdown a "PC" system, and some work better than others on different boxes. You can control which ones Proc32 tries in which order with the -b options to Proc32 -- this is pretty clearly documented in the Proc32 documentation. It is only at this point that anybody gets involved in hardware shutdown. So, if the machine is shutting down, but not rebooting, take a look at the various -b options to Proc32, try different ones, until the box will shutdown properly.
(Note: The -b option has evolved over time as we hit more hardware that failed to reboot using the previous "standard" method. The full control mentioned above is available in 4.25, earlier versions may have more limitted control or flexibility in how to reboot.See the online docs for details.) |
|