user787084
user787084

Reputation:

Manage process in Linux with C++

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

Answers (2)

spraff
spraff

Reputation: 33385

You want to send it a kill signal.

Upvotes: 1

MKP
MKP

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

Related Questions