summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbyungchul <byungchul@chromium.org>2015-02-09 10:57:52 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-09 18:58:40 +0000
commit93ae819382c85b70a511fac5831a1cdeb233d22d (patch)
tree4ea5eda18ac4a6c5248f8e5cb0e1088a19c1aa16
parentbefec2df725594aab2e70e3ed9f4ab3598351bc0 (diff)
downloadchromium_src-93ae819382c85b70a511fac5831a1cdeb233d22d.zip
chromium_src-93ae819382c85b70a511fac5831a1cdeb233d22d.tar.gz
chromium_src-93ae819382c85b70a511fac5831a1cdeb233d22d.tar.bz2
Get SIGTERM when parent process dies.
Cast shell needs to exist when the parent process dies. BUG=internal b/19182288 Review URL: https://codereview.chromium.org/872073005 Cr-Commit-Position: refs/heads/master@{#315356}
-rw-r--r--chromecast/browser/cast_browser_main_parts.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc
index 263d595..7a6e600 100644
--- a/chromecast/browser/cast_browser_main_parts.cc
+++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -5,6 +5,7 @@
#include "chromecast/browser/cast_browser_main_parts.h"
#include <signal.h>
+#include <sys/prctl.h>
#include "base/command_line.h"
#include "base/files/file_util.h"
@@ -57,6 +58,8 @@ void RunClosureOnSignal(int signum) {
void RegisterClosureOnSignal(const base::Closure& closure) {
DCHECK(!g_signal_closure);
+ DCHECK_GT(arraysize(kSignalsToRunClosure), 0U);
+
// Allow memory leak by intention.
g_signal_closure = new base::Closure(closure);
@@ -74,6 +77,9 @@ void RegisterClosureOnSignal(const base::Closure& closure) {
DCHECK_EQ(sa_old.sa_handler, SIG_DFL);
}
}
+
+ // Get the first signal to exit when the parent process dies.
+ prctl(PR_SET_PDEATHSIG, kSignalsToRunClosure[0]);
}
} // namespace