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_main.h" | 5 #include "content/zygote/zygote_main.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <errno.h> |
8 #include <fcntl.h> | 9 #include <fcntl.h> |
9 #include <pthread.h> | 10 #include <pthread.h> |
10 #include <stdio.h> | 11 #include <stdio.h> |
11 #include <sys/socket.h> | 12 #include <sys/socket.h> |
12 #include <sys/stat.h> | 13 #include <sys/stat.h> |
13 #include <sys/types.h> | 14 #include <sys/types.h> |
14 #include <sys/wait.h> | 15 #include <sys/wait.h> |
15 #include <unistd.h> | 16 #include <unistd.h> |
16 | 17 |
17 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
18 #include "base/bind.h" | 19 #include "base/bind.h" |
19 #include "base/callback.h" | 20 #include "base/callback.h" |
20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
21 #include "base/linux_util.h" | 22 #include "base/linux_util.h" |
22 #include "base/native_library.h" | 23 #include "base/native_library.h" |
23 #include "base/pickle.h" | 24 #include "base/pickle.h" |
24 #include "base/posix/eintr_wrapper.h" | |
25 #include "base/posix/unix_domain_socket_linux.h" | 25 #include "base/posix/unix_domain_socket_linux.h" |
26 #include "base/rand_util.h" | 26 #include "base/rand_util.h" |
27 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
28 #include "build/build_config.h" | 28 #include "build/build_config.h" |
29 #include "content/common/child_process_sandbox_support_impl_linux.h" | 29 #include "content/common/child_process_sandbox_support_impl_linux.h" |
30 #include "content/common/font_config_ipc_linux.h" | 30 #include "content/common/font_config_ipc_linux.h" |
31 #include "content/common/pepper_plugin_list.h" | 31 #include "content/common/pepper_plugin_list.h" |
32 #include "content/common/sandbox_linux.h" | 32 #include "content/common/sandbox_linux.h" |
33 #include "content/common/zygote_commands_linux.h" | 33 #include "content/common/zygote_commands_linux.h" |
34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 PreloadPepperPlugins(); | 304 PreloadPepperPlugins(); |
305 #endif | 305 #endif |
306 #if defined(ENABLE_WEBRTC) | 306 #if defined(ENABLE_WEBRTC) |
307 InitializeWebRtcModule(); | 307 InitializeWebRtcModule(); |
308 #endif | 308 #endif |
309 SkFontConfigInterface::SetGlobal( | 309 SkFontConfigInterface::SetGlobal( |
310 new FontConfigIPC(GetSandboxFD()))->unref(); | 310 new FontConfigIPC(GetSandboxFD()))->unref(); |
311 } | 311 } |
312 | 312 |
313 static void CloseFdAndHandleEintr(int fd) { | 313 static void CloseFdAndHandleEintr(int fd) { |
314 (void) HANDLE_EINTR(close(fd)); | 314 close(fd); |
315 } | 315 } |
316 | 316 |
317 // This will set the *using_suid_sandbox variable to true if the SUID sandbox | 317 // This will set the *using_suid_sandbox variable to true if the SUID sandbox |
318 // is enabled. This does not necessarily exclude other types of sandboxing. | 318 // is enabled. This does not necessarily exclude other types of sandboxing. |
319 static bool EnterSuidSandbox(LinuxSandbox* linux_sandbox, | 319 static bool EnterSuidSandbox(LinuxSandbox* linux_sandbox, |
320 bool* using_suid_sandbox, | 320 bool* using_suid_sandbox, |
321 bool* has_started_new_init) { | 321 bool* has_started_new_init) { |
322 *using_suid_sandbox = false; | 322 *using_suid_sandbox = false; |
323 *has_started_new_init = false; | 323 *has_started_new_init = false; |
324 | 324 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 } | 434 } |
435 | 435 |
436 int sandbox_flags = linux_sandbox->GetStatus(); | 436 int sandbox_flags = linux_sandbox->GetStatus(); |
437 | 437 |
438 Zygote zygote(sandbox_flags, forkdelegate); | 438 Zygote zygote(sandbox_flags, forkdelegate); |
439 // This function call can return multiple times, once per fork(). | 439 // This function call can return multiple times, once per fork(). |
440 return zygote.ProcessRequests(); | 440 return zygote.ProcessRequests(); |
441 } | 441 } |
442 | 442 |
443 } // namespace content | 443 } // namespace content |
OLD | NEW |