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 "components/nacl/zygote/nacl_fork_delegate_linux.h" | 5 #include "components/nacl/zygote/nacl_fork_delegate_linux.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
11 #include <sys/socket.h> | 11 #include <sys/socket.h> |
12 | 12 |
13 #include <memory> | |
14 #include <set> | 13 #include <set> |
15 | 14 |
16 #include "base/command_line.h" | 15 #include "base/command_line.h" |
17 #include "base/cpu.h" | 16 #include "base/cpu.h" |
18 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
19 #include "base/files/scoped_file.h" | 18 #include "base/files/scoped_file.h" |
20 #include "base/logging.h" | 19 #include "base/logging.h" |
21 #include "base/macros.h" | 20 #include "base/macros.h" |
22 #include "base/memory/scoped_vector.h" | 21 #include "base/memory/ptr_util.h" |
23 #include "base/path_service.h" | 22 #include "base/path_service.h" |
24 #include "base/pickle.h" | 23 #include "base/pickle.h" |
25 #include "base/posix/eintr_wrapper.h" | 24 #include "base/posix/eintr_wrapper.h" |
26 #include "base/posix/global_descriptors.h" | 25 #include "base/posix/global_descriptors.h" |
27 #include "base/posix/unix_domain_socket_linux.h" | 26 #include "base/posix/unix_domain_socket_linux.h" |
28 #include "base/process/kill.h" | 27 #include "base/process/kill.h" |
29 #include "base/process/launch.h" | 28 #include "base/process/launch.h" |
30 #include "base/strings/string_split.h" | 29 #include "base/strings/string_split.h" |
31 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 30 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
32 #include "build/build_config.h" | 31 #include "build/build_config.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 123 } |
125 *reply_size = msg_len; | 124 *reply_size = msg_len; |
126 return true; | 125 return true; |
127 } | 126 } |
128 | 127 |
129 } // namespace. | 128 } // namespace. |
130 | 129 |
131 namespace nacl { | 130 namespace nacl { |
132 | 131 |
133 void AddNaClZygoteForkDelegates( | 132 void AddNaClZygoteForkDelegates( |
134 ScopedVector<content::ZygoteForkDelegate>* delegates) { | 133 std::vector<std::unique_ptr<content::ZygoteForkDelegate>>* delegates) { |
135 delegates->push_back(new NaClForkDelegate(false /* nonsfi_mode */)); | 134 delegates->push_back( |
136 delegates->push_back(new NaClForkDelegate(true /* nonsfi_mode */)); | 135 base::MakeUnique<NaClForkDelegate>(false /* nonsfi_mode */)); |
| 136 delegates->push_back( |
| 137 base::MakeUnique<NaClForkDelegate>(true /* nonsfi_mode */)); |
137 } | 138 } |
138 | 139 |
139 NaClForkDelegate::NaClForkDelegate(bool nonsfi_mode) | 140 NaClForkDelegate::NaClForkDelegate(bool nonsfi_mode) |
140 : nonsfi_mode_(nonsfi_mode), status_(kNaClHelperUnused), fd_(-1) { | 141 : nonsfi_mode_(nonsfi_mode), status_(kNaClHelperUnused), fd_(-1) { |
141 } | 142 } |
142 | 143 |
143 void NaClForkDelegate::Init(const int sandboxdesc, | 144 void NaClForkDelegate::Init(const int sandboxdesc, |
144 const bool enable_layer1_sandbox) { | 145 const bool enable_layer1_sandbox) { |
145 VLOG(1) << "NaClForkDelegate::Init()"; | 146 VLOG(1) << "NaClForkDelegate::Init()"; |
146 | 147 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 pass_through_vars.push_back(kNaClVerbosity); | 458 pass_through_vars.push_back(kNaClVerbosity); |
458 pass_through_vars.push_back(sandbox::kSandboxEnvironmentApiRequest); | 459 pass_through_vars.push_back(sandbox::kSandboxEnvironmentApiRequest); |
459 for (size_t i = 0; i < pass_through_vars.size(); ++i) { | 460 for (size_t i = 0; i < pass_through_vars.size(); ++i) { |
460 std::string temp; | 461 std::string temp; |
461 if (env->GetVar(pass_through_vars[i].c_str(), &temp)) | 462 if (env->GetVar(pass_through_vars[i].c_str(), &temp)) |
462 options->environ[pass_through_vars[i]] = temp; | 463 options->environ[pass_through_vars[i]] = temp; |
463 } | 464 } |
464 } | 465 } |
465 | 466 |
466 } // namespace nacl | 467 } // namespace nacl |
OLD | NEW |