OS2 World Community Forum
OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Dariusz Piatkowski on November 04, 2020, 05:15:20 pm
-
So I need to kill a process given a particular flag being set.
I figured this would be easy in REXX, and most likley would rely on a suitable API call or a built-in function. However, no such thing has been found (REXX newbie here, so take it easy... ;))
But, I did start looking at RXU library, indeed, I can see that I could use:
dosrc = RxQProcStatus(stemname [,flags])
to get the equivalent of PSTAT result.
From there I could fish out the matching record for a particular module (an EXE in my case) and once I have the PID I could call:
killrc = RxKillProcess(pid [, action])
But all this still seems a little convoluted, I mean is there no simpler way to kill a process than having to point to it by a PID? Yes, I understand the reason for this, but if I have a single instantiation of a particular EXE I know that killing it by module name is just fine.
Any suggestions where to look next?
Oh, sure, I could call one of the utilities that do this, but I was hoping to push my REXX "boundaries" a tad and see how this could be implemented, any suggestions?
Thanks!
-
Try PKILL.EXE. It seems to be included in ArcaOS, and only needs the program name, not a PID.
-
So I need to kill a process given a particular flag being set.
I figured this would be easy in REXX, and most likley would rely on a suitable API call or a built-in function. However, no such thing has been found (REXX newbie here, so take it easy... ;))
But, I did start looking at RXU library, indeed, I can see that I could use:
dosrc = RxQProcStatus(stemname [,flags])
to get the equivalent of PSTAT result.
From there I could fish out the matching record for a particular module (an EXE in my case) and once I have the PID I could call:
killrc = RxKillProcess(pid [, action])
But all this still seems a little convoluted, I mean is there no simpler way to kill a process than having to point to it by a PID? Yes, I understand the reason for this, but if I have a single instantiation of a particular EXE I know that killing it by module name is just fine.
Any suggestions where to look next?
Oh, sure, I could call one of the utilities that do this, but I was hoping to push my REXX "boundaries" a tad and see how this could be implemented, any suggestions?
Thanks!
Hi Dariusz,
Check these dlls, very easy to use
http://www.edm2.com/index.php/Category:RxUtilEx
http://www.edm2.com/index.php/Sys2QueryProcess
http://www.edm2.com/index.php/Sys2KillProcess
rxutilex dll doc is available under ArcaOS as well the dll.
Cheers/2
Rémy
-
Hi Remy!
...Check these dlls, very easy to use
http://www.edm2.com/index.php/Category:RxUtilEx
http://www.edm2.com/index.php/Sys2QueryProcess
http://www.edm2.com/index.php/Sys2KillProcess...
Perfect, exactly what I was looking for! Thank you...
-
Hi Doug,
Try PKILL.EXE. It seems to be included in ArcaOS, and only needs the program name, not a PID.
Yup, I got this one on my machine already, but I really wanted to do this through REXX (if anything, it's a bit a learning experience). I'll pursue Remy's suggestion.