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

Unified Diff: chrome/browser/zygote_host_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.h ('k') | chrome/browser/zygote_main_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/zygote_host_linux.cc
diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc
index f01bcf11620bb0a9a83e778fbef159f41d9f0637..6e8c75e4c51f97a233cf7f6852a4eed13bad6b66 100644
--- a/chrome/browser/zygote_host_linux.cc
+++ b/chrome/browser/zygote_host_linux.cc
@@ -302,13 +302,18 @@ void ZygoteHost::EnsureProcessTerminated(pid_t process) {
PLOG(ERROR) << "write";
}
-bool ZygoteHost::DidProcessCrash(base::ProcessHandle handle,
- bool* child_exited) {
+base::TerminationStatus ZygoteHost::GetTerminationStatus(
+ base::ProcessHandle handle,
+ int* exit_code) {
DCHECK(init_);
Pickle pickle;
- pickle.WriteInt(kCmdDidProcessCrash);
+ pickle.WriteInt(kCmdGetTerminationStatus);
pickle.WriteInt(handle);
+ // Set this now to handle the early termination cases.
+ if (exit_code)
+ *exit_code = 0;
+
static const unsigned kMaxMessageLength = 128;
char buf[kMaxMessageLength];
ssize_t len;
@@ -322,23 +327,23 @@ bool ZygoteHost::DidProcessCrash(base::ProcessHandle handle,
if (len == -1) {
LOG(WARNING) << "Error reading message from zygote: " << errno;
- return false;
+ return base::TERMINATION_STATUS_NORMAL_TERMINATION;
} else if (len == 0) {
LOG(WARNING) << "Socket closed prematurely.";
- return false;
+ return base::TERMINATION_STATUS_NORMAL_TERMINATION;
}
Pickle read_pickle(buf, len);
- bool did_crash, tmp_child_exited;
+ int status, tmp_exit_code;
void* iter = NULL;
- if (!read_pickle.ReadBool(&iter, &did_crash) ||
- !read_pickle.ReadBool(&iter, &tmp_child_exited)) {
- LOG(WARNING) << "Error parsing DidProcessCrash response from zygote.";
- return false;
+ if (!read_pickle.ReadInt(&iter, &status) ||
+ !read_pickle.ReadInt(&iter, &tmp_exit_code)) {
+ LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote.";
+ return base::TERMINATION_STATUS_NORMAL_TERMINATION;
}
- if (child_exited)
- *child_exited = tmp_child_exited;
+ if (exit_code)
+ *exit_code = tmp_exit_code;
- return did_crash;
+ return static_cast<base::TerminationStatus>(status);
}
« no previous file with comments | « chrome/browser/zygote_host_linux.h ('k') | chrome/browser/zygote_main_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698