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

Side by Side Diff: content/zygote/zygote_linux.cc

Issue 1685183004: Bootstrap Mojo IPC independent of Chrome IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « content/public/common/zygote_fork_delegate_linux.h ('k') | ipc/ipc_descriptors.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/zygote/zygote_linux.h" 5 #include "content/zygote/zygote_linux.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <poll.h> 9 #include <poll.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } 429 }
430 430
431 base::ScopedFD read_pipe, write_pipe; 431 base::ScopedFD read_pipe, write_pipe;
432 base::ProcessId pid = 0; 432 base::ProcessId pid = 0;
433 if (helper) { 433 if (helper) {
434 int ipc_channel_fd = LookUpFd(fd_mapping, kPrimaryIPCChannel); 434 int ipc_channel_fd = LookUpFd(fd_mapping, kPrimaryIPCChannel);
435 if (ipc_channel_fd < 0) { 435 if (ipc_channel_fd < 0) {
436 DLOG(ERROR) << "Failed to find kPrimaryIPCChannel in FD mapping"; 436 DLOG(ERROR) << "Failed to find kPrimaryIPCChannel in FD mapping";
437 return -1; 437 return -1;
438 } 438 }
439 int mojo_channel_fd = LookUpFd(fd_mapping, kMojoIPCChannel);
440 if (mojo_channel_fd < 0) {
441 DLOG(ERROR) << "Failed to find kMojoIPCChannel in FD mapping";
442 return -1;
443 }
439 std::vector<int> fds; 444 std::vector<int> fds;
440 fds.push_back(ipc_channel_fd); // kBrowserFDIndex 445 fds.push_back(ipc_channel_fd); // kBrowserFDIndex
441 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex 446 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex
447 fds.push_back(mojo_channel_fd); // kMojoParentFDIndex
442 pid = helper->Fork(process_type, fds, channel_id); 448 pid = helper->Fork(process_type, fds, channel_id);
443 449
444 // Helpers should never return in the child process. 450 // Helpers should never return in the child process.
445 CHECK_NE(pid, 0); 451 CHECK_NE(pid, 0);
446 } else { 452 } else {
447 CreatePipe(&read_pipe, &write_pipe); 453 CreatePipe(&read_pipe, &write_pipe);
448 if (sandbox_flags_ & kSandboxLinuxPIDNS && 454 if (sandbox_flags_ & kSandboxLinuxPIDNS &&
449 sandbox_flags_ & kSandboxLinuxUserNS) { 455 sandbox_flags_ & kSandboxLinuxUserNS) {
450 pid = sandbox::NamespaceSandbox::ForkInNewPidNamespace( 456 pid = sandbox::NamespaceSandbox::ForkInNewPidNamespace(
451 /*drop_capabilities_in_child=*/true); 457 /*drop_capabilities_in_child=*/true);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { 671 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) {
666 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != 672 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) !=
667 sizeof(sandbox_flags_)) { 673 sizeof(sandbox_flags_)) {
668 PLOG(ERROR) << "write"; 674 PLOG(ERROR) << "write";
669 } 675 }
670 676
671 return false; 677 return false;
672 } 678 }
673 679
674 } // namespace content 680 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/zygote_fork_delegate_linux.h ('k') | ipc/ipc_descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698