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

Unified Diff: content/common/child_process_sandbox_support_impl_linux.cc

Issue 240463005: Stop using chrome-sandbox to determine real pids (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix an embarassing number of compile errors Created 6 years, 8 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 | « content/browser/zygote_host/zygote_host_impl_linux.cc ('k') | content/common/sandbox_linux/sandbox_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/child_process_sandbox_support_impl_linux.cc
diff --git a/content/common/child_process_sandbox_support_impl_linux.cc b/content/common/child_process_sandbox_support_impl_linux.cc
index a810e5c42c005f2bb600ca27af2763ec7c3ebe25..da5365f1012900cbd6582c73c0a5f02b2379a75f 100644
--- a/content/common/child_process_sandbox_support_impl_linux.cc
+++ b/content/common/child_process_sandbox_support_impl_linux.cc
@@ -181,4 +181,32 @@ bool GetFontTable(int fd, uint32_t table_tag, off_t offset,
return true;
}
+bool SendRealPidToZygote(int fd, base::ProcessId* out_pid) {
+ Pickle request;
+ request.WriteInt(LinuxSandbox::METHOD_GET_REAL_PID);
+ request.WriteBool(out_pid != NULL);
+
+ uint8_t buf[512];
+ const ssize_t n = UnixDomainSocket::SendRecvMsgWithFD(
+ GetSandboxFD(), buf, sizeof(buf), NULL, request, fd);
+ if (n < 0)
+ return false;
+
+ Pickle reply(reinterpret_cast<char*>(buf), n);
+ PickleIterator iter(reply);
+ int real_pid;
+ if (!iter.ReadInt(&real_pid))
+ return false;
+
+ if (out_pid)
+ *out_pid = real_pid;
+ else {
+ // If caller doesn't want to receive its real PID, then make sure the
+ // browser didn't send it to us.
+ CHECK_EQ(0, real_pid);
+ }
+
+ return true;
+}
+
} // namespace content
« no previous file with comments | « content/browser/zygote_host/zygote_host_impl_linux.cc ('k') | content/common/sandbox_linux/sandbox_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698