{
if(cpid) {
L<<Logger::Error<<"Guardian is killed, taking down children with us"<<endl;
- kill(cpid,SIGKILL);
+ kill(-getpgid(cpid),SIGKILL);
exit(0);
}
}
// The next two methods are not in dynhandler.cc because they use a few items declared in this file.
static string DLCycleHandler(const vector<string>&parts, pid_t ppid)
{
- kill(cpid, SIGKILL); // why?
- kill(cpid, SIGKILL); // why?
+ kill(-getpgid(cpid), SIGKILL);
sleep(1);
return "ok";
}
signal(SIGUSR1, SIG_DFL);
signal(SIGUSR2, SIG_DFL);
+ // Set different pgrp for this child,
+ // so we could kill all of it's children
+ // with one kill call
+ setpgid(getpid(), 0);
+
char **const newargv=new char*[argc+2];
int n;