C code for killall function
C code for killall function
What is the C code equivalent for this bash code below killall smbd In C code, I can only find this kill (pid, SIGTERM) I know how to search for a process name and find its pid to shut down a process, but is there a killall function in C code as in killall (pid, SIGTERM) ? |
Try reading the source of killall, or how to execute shell commands via C.
|
No, there's no syscall to do a killall.
Your best bet is to run through /proc/<digits> and check the first line of the "status" pseudo-file for the name. If it matches, kill that process. Jeremy |
you have to be root to be able to execute the killall command...
you could use pkill <process name>..and if you are the owner of the process, you will be able to kill it.... u may use system() to do this...... hope this helped...if you really want to do this the hard way...what jemfinch says is good enough to satisfy your thirst to write C code |
All times are GMT -5. The time now is 08:41 AM. |