| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/zygote_host_linux.h" | 5 #include "content/browser/zygote_host_linux.h" |
| 6 | 6 |
| 7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 const int sfd = RenderSandboxHostLinux::GetInstance()->GetRendererSocket(); | 142 const int sfd = RenderSandboxHostLinux::GetInstance()->GetRendererSocket(); |
| 143 fds_to_map.push_back(std::make_pair(sfd, 5)); | 143 fds_to_map.push_back(std::make_pair(sfd, 5)); |
| 144 | 144 |
| 145 int dummy_fd = -1; | 145 int dummy_fd = -1; |
| 146 if (using_suid_sandbox_) { | 146 if (using_suid_sandbox_) { |
| 147 dummy_fd = socket(PF_UNIX, SOCK_DGRAM, 0); | 147 dummy_fd = socket(PF_UNIX, SOCK_DGRAM, 0); |
| 148 CHECK(dummy_fd >= 0); | 148 CHECK(dummy_fd >= 0); |
| 149 fds_to_map.push_back(std::make_pair(dummy_fd, 7)); | 149 fds_to_map.push_back(std::make_pair(dummy_fd, 7)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 base::ProcessHandle process; | 152 base::ProcessHandle process = -1; |
| 153 base::LaunchApp(cmd_line.argv(), fds_to_map, false, &process); | 153 base::LaunchOptions options; |
| 154 options.process_handle = &process; |
| 155 options.fds_to_remap = &fds_to_map; |
| 156 base::LaunchProcess(cmd_line.argv(), options); |
| 154 CHECK(process != -1) << "Failed to launch zygote process"; | 157 CHECK(process != -1) << "Failed to launch zygote process"; |
| 155 | 158 |
| 156 if (using_suid_sandbox_) { | 159 if (using_suid_sandbox_) { |
| 157 // In the SUID sandbox, the real zygote is forked from the sandbox. | 160 // In the SUID sandbox, the real zygote is forked from the sandbox. |
| 158 // We need to look for it. | 161 // We need to look for it. |
| 159 // But first, wait for the zygote to tell us it's running. | 162 // But first, wait for the zygote to tell us it's running. |
| 160 // The sending code is in chrome/browser/zygote_main_linux.cc. | 163 // The sending code is in chrome/browser/zygote_main_linux.cc. |
| 161 std::vector<int> fds_vec; | 164 std::vector<int> fds_vec; |
| 162 const int kExpectedLength = sizeof(kZygoteMagic); | 165 const int kExpectedLength = sizeof(kZygoteMagic); |
| 163 char buf[kExpectedLength]; | 166 char buf[kExpectedLength]; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 !read_pickle.ReadInt(&iter, &tmp_exit_code)) { | 365 !read_pickle.ReadInt(&iter, &tmp_exit_code)) { |
| 363 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote."; | 366 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote."; |
| 364 return base::TERMINATION_STATUS_NORMAL_TERMINATION; | 367 return base::TERMINATION_STATUS_NORMAL_TERMINATION; |
| 365 } | 368 } |
| 366 | 369 |
| 367 if (exit_code) | 370 if (exit_code) |
| 368 *exit_code = tmp_exit_code; | 371 *exit_code = tmp_exit_code; |
| 369 | 372 |
| 370 return static_cast<base::TerminationStatus>(status); | 373 return static_cast<base::TerminationStatus>(status); |
| 371 } | 374 } |
| OLD | NEW |