Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1785)

Unified Diff: chrome/browser/zygote_main_linux.cc

Issue 3386014: This adds some plumbing for propagating the status and error code of a (Closed)
Patch Set: Fixed Mac code to handle both SEGV and BUS Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/zygote_host_linux.cc ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/zygote_main_linux.cc
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index fada72fa338e29c9a38dc0ab1e5eee122dc0b6c2..16ccc50557ead61233d3e91ead3bc492efecaabb 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -166,10 +166,10 @@ class Zygote {
break;
HandleReapRequest(fd, pickle, iter);
return false;
- case ZygoteHost::kCmdDidProcessCrash:
+ case ZygoteHost::kCmdGetTerminationStatus:
if (!fds.empty())
break;
- HandleDidProcessCrash(fd, pickle, iter);
+ HandleGetTerminationStatus(fd, pickle, iter);
return false;
case ZygoteHost::kCmdGetSandboxStatus:
HandleGetSandboxStatus(fd, pickle, iter);
@@ -208,26 +208,31 @@ class Zygote {
ProcessWatcher::EnsureProcessTerminated(actual_child);
}
- void HandleDidProcessCrash(int fd, const Pickle& pickle, void* iter) {
+ void HandleGetTerminationStatus(int fd, const Pickle& pickle, void* iter) {
base::ProcessHandle child;
if (!pickle.ReadInt(&iter, &child)) {
- LOG(WARNING) << "Error parsing DidProcessCrash request from browser";
+ LOG(WARNING) << "Error parsing GetTerminationStatus request "
+ << "from browser";
return;
}
- bool child_exited;
- bool did_crash;
+ base::TerminationStatus status;
+ int exit_code;
if (g_suid_sandbox_active)
child = real_pids_to_sandbox_pids[child];
- if (child)
- did_crash = base::DidProcessCrash(&child_exited, child);
- else
- did_crash = child_exited = false;
+ if (child) {
+ status = base::GetTerminationStatus(child, &exit_code);
+ } else {
+ // Assume that if we can't find the child in the sandbox, then
+ // it terminated normally.
+ status = base::TERMINATION_STATUS_NORMAL_TERMINATION;
+ exit_code = 0;
+ }
Pickle write_pickle;
- write_pickle.WriteBool(did_crash);
- write_pickle.WriteBool(child_exited);
+ write_pickle.WriteInt(static_cast<int>(status));
+ write_pickle.WriteInt(exit_code);
if (HANDLE_EINTR(write(fd, write_pickle.data(), write_pickle.size())) !=
write_pickle.size()) {
PLOG(ERROR) << "write";
« no previous file with comments | « chrome/browser/zygote_host_linux.cc ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698