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 "crypto/nss_util.h" | 31 #include "crypto/nss_util.h" |
32 #include "ipc/ipc_descriptors.h" | 32 #include "ipc/ipc_descriptors.h" |
33 #include "ipc/ipc_switches.h" | 33 #include "ipc/ipc_switches.h" |
34 #include "sandbox/linux/services/libc_urandom_override.h" | 34 #include "sandbox/linux/services/libc_urandom_override.h" |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 // The child must mimic the behavior of zygote_main_linux.cc on the child | 38 // The child must mimic the behavior of zygote_main_linux.cc on the child |
39 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from | 39 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from |
40 // if (!child) { | 40 // if (!child) { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 _exit(-1); | 282 _exit(-1); |
283 } | 283 } |
284 // if fork fails, send PID=-1 to zygote | 284 // if fork fails, send PID=-1 to zygote |
285 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, | 285 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, |
286 sizeof(badpid), empty)) { | 286 sizeof(badpid), empty)) { |
287 LOG(ERROR) << "*** send() to zygote failed"; | 287 LOG(ERROR) << "*** send() to zygote failed"; |
288 } | 288 } |
289 } | 289 } |
290 CHECK(false); // This routine must not return | 290 CHECK(false); // This routine must not return |
291 } | 291 } |
OLD | NEW |