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 // A mini-zygote specifically for Native Client. | 5 // A mini-zygote specifically for Native Client. |
6 | 6 |
7 #include "chrome/common/nacl_helper_linux.h" | 7 #include "components/nacl/common/nacl_helper_linux.h" |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
11 #include <link.h> | 11 #include <link.h> |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 #include <stdlib.h> | 13 #include <stdlib.h> |
14 #include <sys/socket.h> | 14 #include <sys/socket.h> |
15 #include <sys/stat.h> | 15 #include <sys/stat.h> |
16 #include <sys/types.h> | 16 #include <sys/types.h> |
17 | 17 |
18 #include <string> | 18 #include <string> |
19 #include <vector> | 19 #include <vector> |
20 | 20 |
21 #include "base/at_exit.h" | 21 #include "base/at_exit.h" |
22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
23 #include "base/json/string_escape.h" | 23 #include "base/json/string_escape.h" |
24 #include "base/logging.h" | 24 #include "base/logging.h" |
25 #include "base/message_loop.h" | 25 #include "base/message_loop.h" |
26 #include "base/posix/eintr_wrapper.h" | 26 #include "base/posix/eintr_wrapper.h" |
27 #include "base/posix/global_descriptors.h" | 27 #include "base/posix/global_descriptors.h" |
28 #include "base/posix/unix_domain_socket_linux.h" | 28 #include "base/posix/unix_domain_socket_linux.h" |
29 #include "base/rand_util.h" | 29 #include "base/rand_util.h" |
30 #include "chrome/nacl/nacl_listener.h" | 30 #include "components/nacl/loader/nacl_listener.h" |
31 #include "chrome/nacl/nacl_sandbox_linux.h" | 31 #include "components/nacl/loader/nacl_sandbox_linux.h" |
32 #include "crypto/nss_util.h" | 32 #include "crypto/nss_util.h" |
33 #include "ipc/ipc_descriptors.h" | 33 #include "ipc/ipc_descriptors.h" |
34 #include "ipc/ipc_switches.h" | 34 #include "ipc/ipc_switches.h" |
35 #include "sandbox/linux/services/libc_urandom_override.h" | 35 #include "sandbox/linux/services/libc_urandom_override.h" |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 // The child must mimic the behavior of zygote_main_linux.cc on the child | 39 // The child must mimic the behavior of zygote_main_linux.cc on the child |
40 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from | 40 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from |
41 // if (!child) { | 41 // if (!child) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 _exit(-1); | 291 _exit(-1); |
292 } | 292 } |
293 // if fork fails, send PID=-1 to zygote | 293 // if fork fails, send PID=-1 to zygote |
294 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, | 294 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, |
295 sizeof(badpid), empty)) { | 295 sizeof(badpid), empty)) { |
296 LOG(ERROR) << "*** send() to zygote failed"; | 296 LOG(ERROR) << "*** send() to zygote failed"; |
297 } | 297 } |
298 } | 298 } |
299 CHECK(false); // This routine must not return | 299 CHECK(false); // This routine must not return |
300 } | 300 } |
OLD | NEW |