I am running nmap from a C program using execl:
execl("/bin/sh","sh","-c","sudo nmap -sS -A 192.168.0.1/24",NULL);
I have HTOP running in in another shell window and I see that my execl
starts there PIDs:
2339 for command "nmap -sS .."
2335 for command "sudo nmap -sS .."
2334 for command "sh .."
The child PID is 2334. Nmap takes a long time to finish and if I want to kill all three processes I issue kill 2339
from the shell. All 2339,2335 and 2334 then vanish from HTOP monitoring program.
What I would like to do is issue kill(2339, ...) within my C program and kill all like I can do from the shell. My problem is that how do I get the PID 2339? My childPID is in this example 2334.