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

Unified Diff: content/zygote/zygote_linux.cc

Issue 23956010: Define magic descriptors in one place. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 | « content/zygote/zygote_linux.h ('k') | content/zygote/zygote_main_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/zygote/zygote_linux.cc
diff --git a/content/zygote/zygote_linux.cc b/content/zygote/zygote_linux.cc
index 4b83444929b4807b2414a4d0b0ba9e4b572ae923..4146f92af4dff9d279166fd42c90fbba0b7f2e87 100644
--- a/content/zygote/zygote_linux.cc
+++ b/content/zygote/zygote_linux.cc
@@ -20,6 +20,7 @@
#include "base/posix/global_descriptors.h"
#include "base/posix/unix_domain_socket_linux.h"
#include "base/process/kill.h"
+#include "content/common/child_process_sandbox_support_impl_linux.h"
#include "content/common/sandbox_linux.h"
#include "content/common/set_process_title.h"
#include "content/common/zygote_commands_linux.h"
@@ -42,8 +43,6 @@ void SIGCHLDHandler(int signal) {
} // namespace
-const int Zygote::kMagicSandboxIPCDescriptor;
-
Zygote::Zygote(int sandbox_flags,
ZygoteForkDelegate* helper)
: sandbox_flags_(sandbox_flags),
@@ -77,7 +76,7 @@ bool Zygote::ProcessRequests() {
// Let the ZygoteHost know we are ready to go.
// The receiving code is in content/browser/zygote_host_linux.cc.
std::vector<int> empty;
- bool r = UnixDomainSocket::SendMsg(kBrowserDescriptor,
+ bool r = UnixDomainSocket::SendMsg(kZygoteSocketPairFd,
kZygoteHelloMessage,
sizeof(kZygoteHelloMessage), empty);
#if defined(OS_CHROMEOS)
@@ -94,7 +93,7 @@ bool Zygote::ProcessRequests() {
for (;;) {
// This function call can return multiple times, once per fork().
- if (HandleRequestFromBrowser(kBrowserDescriptor))
+ if (HandleRequestFromBrowser(kZygoteSocketPairFd))
return true;
}
}
@@ -363,7 +362,7 @@ int Zygote::ForkWithRealPid(const std::string& process_type,
request.WriteUInt64(dummy_inode);
const ssize_t r = UnixDomainSocket::SendRecvMsg(
- kMagicSandboxIPCDescriptor, reply_buf, sizeof(reply_buf), NULL,
+ GetSandboxFD(), reply_buf, sizeof(reply_buf), NULL,
request);
if (r == -1) {
LOG(ERROR) << "Failed to get child process's real PID";
@@ -466,7 +465,7 @@ base::ProcessId Zygote::ReadArgsAndFork(const Pickle& pickle,
}
mapping.push_back(std::make_pair(
- static_cast<uint32_t>(kSandboxIPCChannel), kMagicSandboxIPCDescriptor));
+ static_cast<uint32_t>(kSandboxIPCChannel), GetSandboxFD()));
// Returns twice, once per process.
base::ProcessId child_pid = ForkWithRealPid(process_type, fds, channel_id,
@@ -475,7 +474,7 @@ base::ProcessId Zygote::ReadArgsAndFork(const Pickle& pickle,
if (!child_pid) {
// This is the child process.
- close(kBrowserDescriptor); // Our socket from the browser.
+ close(kZygoteSocketPairFd); // Our socket from the browser.
if (UsingSUIDSandbox())
close(kZygoteIdFd); // Another socket from the browser.
base::GlobalDescriptors::GetInstance()->Reset(mapping);
« no previous file with comments | « content/zygote/zygote_linux.h ('k') | content/zygote/zygote_main_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698