Meredith Dill <firstname.lastname@example.org> wrote:
yes, that’s it exactly! half of the problem is figuring out what
question to ask!
Of course, using system() to call slay is fairly heavy – it will
spawn a shell which will then run slay.
Somewhat more efficient is to run slay directly – look at the family
of spawn*() calls. This will only start one new process, not two.
Even more efficient is to write a slay() library routine.
What slay does is take advantage of the fact that a qnx_psinfo() passed
an invalid pid will give information about the process with the next
highest pid. This allows it to walk through the process table. It then
gets the process name from the psinfo information, and compares it to the
name you gave it. It records each match, if only one match, it just delivers
the signal, if multiple, it prompts you for each one – though the -f
option disables this prompting, so for each match, it just calls kill()
to deliver the signal to the matching pid. So, if you want the most
efficient method, write this code yourself.
Pete DiMarco wrote:
Previously, Meredith Dill wrote in qdn.public.qnx4.devtools:
I have a batch file which slays a whole bunch of processes if the
program crashes, and I’d like to write a UI to put on the Phindows
toolbar which does the same thing. So does anyone know how to link to a
batch file, or else run a “slay -f MyProcess”?
Not sure if I understand your question, but here goes…
You can use system() to call programs from C code. In this case
system(“slay -f MyProcess”);
should do the trick.
If you want to add a program to the PDM toolbar, click on the wrench icon (Configuration) on the lower left. The Applications tab is where you can add programs to the toolbar. If you already have a script, you can add it there.
P.S.- “batch file” is a DOS-ism. We call them “scripts”. >
QNX Training Services