Have init kill the process group.

killProcessGroup actually works on cgroups. Kill the POSIX process
group ourselves.

Bug: http://b/29751426
Change-Id: I1a2808488510f4262811b6407bcd0948ad23bc60
This commit is contained in:
Elliott Hughes 2016-08-02 14:20:40 -07:00
parent c97b73aa83
commit 1e73024653
1 changed files with 9 additions and 5 deletions

View File

@ -197,11 +197,15 @@ void Service::NotifyStateChange(const std::string& new_state) const {
}
void Service::KillProcessGroup(int signal) {
LOG(VERBOSE) << "Sending signal " << signal
<< " to service '" << name_
<< "' (pid " << pid_ << ") process group...\n",
kill(pid_, signal);
killProcessGroup(uid_, pid_, signal);
LOG(INFO) << "Sending signal " << signal
<< " to service '" << name_
<< "' (pid " << pid_ << ") process group...";
if (killProcessGroup(uid_, pid_, signal) == -1) {
PLOG(ERROR) << "killProcessGroup(" << uid_ << ", " << pid_ << ", " << signal << ") failed";
}
if (kill(-pid_, signal) == -1) {
PLOG(ERROR) << "kill(" << pid_ << ", " << signal << ") failed";
}
}
void Service::CreateSockets(const std::string& context) {