| OLD | NEW |
| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } | 428 } |
| 429 | 429 |
| 430 base::ScopedFD read_pipe, write_pipe; | 430 base::ScopedFD read_pipe, write_pipe; |
| 431 base::ProcessId pid = 0; | 431 base::ProcessId pid = 0; |
| 432 if (helper) { | 432 if (helper) { |
| 433 int mojo_channel_fd = LookUpFd(fd_mapping, kMojoIPCChannel); | 433 int mojo_channel_fd = LookUpFd(fd_mapping, kMojoIPCChannel); |
| 434 if (mojo_channel_fd < 0) { | 434 if (mojo_channel_fd < 0) { |
| 435 DLOG(ERROR) << "Failed to find kMojoIPCChannel in FD mapping"; | 435 DLOG(ERROR) << "Failed to find kMojoIPCChannel in FD mapping"; |
| 436 return -1; | 436 return -1; |
| 437 } | 437 } |
| 438 int ipc_channel_fd = LookUpFd(fd_mapping, kPrimaryIPCChannel); | |
| 439 DCHECK_EQ(-1, ipc_channel_fd); | |
| 440 std::vector<int> fds; | 438 std::vector<int> fds; |
| 441 fds.push_back(mojo_channel_fd); // kBrowserFDIndex | 439 fds.push_back(mojo_channel_fd); // kBrowserFDIndex |
| 442 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex | 440 fds.push_back(pid_oracle.get()); // kPIDOracleFDIndex |
| 443 pid = helper->Fork(process_type, fds, channel_id); | 441 pid = helper->Fork(process_type, fds, channel_id); |
| 444 | 442 |
| 445 // Helpers should never return in the child process. | 443 // Helpers should never return in the child process. |
| 446 CHECK_NE(pid, 0); | 444 CHECK_NE(pid, 0); |
| 447 } else { | 445 } else { |
| 448 CreatePipe(&read_pipe, &write_pipe); | 446 CreatePipe(&read_pipe, &write_pipe); |
| 449 if (sandbox_flags_ & kSandboxLinuxPIDNS && | 447 if (sandbox_flags_ & kSandboxLinuxPIDNS && |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { | 664 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { |
| 667 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 665 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
| 668 sizeof(sandbox_flags_)) { | 666 sizeof(sandbox_flags_)) { |
| 669 PLOG(ERROR) << "write"; | 667 PLOG(ERROR) << "write"; |
| 670 } | 668 } |
| 671 | 669 |
| 672 return false; | 670 return false; |
| 673 } | 671 } |
| 674 | 672 |
| 675 } // namespace content | 673 } // namespace content |
| OLD | NEW |