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 |