Reputation:
I want to write a program to kill a bad process in Linux.
The program should detect all threads and processes running in Linux. I know I should use the /proc folder but does it return all processes? And how I can kill a process in C++ from its ID?
Thanks and regards.
Upvotes: 0
Views: 1498
Reputation: 200
If you want to kill another process in C on Linux/UNIX you should use kill function (kill man page for more information) and provide as first parameter PID of the process you want to kill and SIGKILL constant as second parameter.
kill(1234, SIGKILL);
Upvotes: 3