summaryrefslogtreecommitdiffstats
path: root/init/service.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-08-02 14:20:40 -0700
committerElliott Hughes <enh@google.com>2016-08-02 14:20:40 -0700
commit1e73024653d962b769387dd4c9ff544b6c8b7cc9 (patch)
treeac34a21a208abd5eaa7f9a5129e04e5a97ffca81 /init/service.cpp
parentc97b73aa83fc7b80b60d88d856675d4ab502296d (diff)
downloadcore-1e73024653d962b769387dd4c9ff544b6c8b7cc9.tar.gz
core-1e73024653d962b769387dd4c9ff544b6c8b7cc9.tar.bz2
core-1e73024653d962b769387dd4c9ff544b6c8b7cc9.zip
Have init kill the process group.
killProcessGroup actually works on cgroups. Kill the POSIX process group ourselves. Bug: http://b/29751426 Change-Id: I1a2808488510f4262811b6407bcd0948ad23bc60
Diffstat (limited to 'init/service.cpp')
-rw-r--r--init/service.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/init/service.cpp b/init/service.cpp
index 44d9d8c77..32aafd61b 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -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) {