QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Making a dumper-style watchdog program in QNX4 |
Ref. No. |
QNX.000009414 |
Category(ies) |
Development |
Issue |
We are using QNX4, and programming with Watcom C 10.6 . We need one of my programs to behave like dumper - to catch any software that sigsegv's, in order to reset the computer.
How does dumper catch all the sigsegvs?
|
Solution |
Dumper sets the _PPF_INFORM flag (see the sys/psinfo.h header) so it gets the death messages. Of course, to do this, it also has to set the _PPF_SERVER flag. You will need to be able, at minimum, to handle all the system messages.
For information on handling all these messages, grab the iomanager framework from the free software archives at http://www.qnx.com/cgi-bin/dir_find.cgi?/usr/free/ . Look at its code to handle the messages, or use the whole program if it helps.
Of course, there are real restrictions on what you can do if you are an informed administrator:
- you can't start new a process, it can cause Proc to deadlock with you, - you must spend most of your time RECEIVE blocked, and - you must Reply() to the death messages quickly.
If not, you can cause inconsistent (poor) system performance. You may also get "can't kill kernel thread" error messages if you aren't quick enough on the death messages.
If you only have to monitor a subset of programs/processes that you have coded, it is cleaner to setup an iomanager, have the processes to be monitored open an fd to you, then watch for the IO_CLOSE message. (And, this is network portable as well. A watchdog on one node can watch processes on multiple nodes).
See Also: qnx_pflags() in Watcom C Library - N to Z |
|