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 // 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 "chrome/common/nacl_helper_linux.h" |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
11 #include <sys/socket.h> | 11 #include <sys/socket.h> |
12 #include <sys/types.h> | 12 #include <sys/types.h> |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/at_exit.h" | 17 #include "base/at_exit.h" |
| 18 #include "base/command_line.h" |
18 #include "base/eintr_wrapper.h" | 19 #include "base/eintr_wrapper.h" |
19 #include "base/logging.h" | 20 #include "base/logging.h" |
20 #include "base/message_loop.h" | 21 #include "base/message_loop.h" |
21 #include "base/rand_util.h" | 22 #include "base/rand_util.h" |
22 #include "chrome/nacl/nacl_listener.h" | 23 #include "chrome/nacl/nacl_listener.h" |
23 #include "content/common/main_function_params.h" | |
24 #include "content/common/unix_domain_socket_posix.h" | 24 #include "content/common/unix_domain_socket_posix.h" |
25 #include "ipc/ipc_switches.h" | 25 #include "ipc/ipc_switches.h" |
26 #include "native_client/src/trusted/service_runtime/sel_memory.h" | 26 #include "native_client/src/trusted/service_runtime/sel_memory.h" |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 bool g_suid_sandbox_active; | 30 bool g_suid_sandbox_active; |
31 | 31 |
32 // The child must mimic the behavior of zygote_main_linux.cc on the child | 32 // The child must mimic the behavior of zygote_main_linux.cc on the child |
33 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from | 33 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 165 } |
166 } | 166 } |
167 // if fork fails, send PID=-1 to zygote | 167 // if fork fails, send PID=-1 to zygote |
168 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, | 168 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, |
169 sizeof(badpid), empty)) { | 169 sizeof(badpid), empty)) { |
170 LOG(ERROR) << "*** send() to zygote failed"; | 170 LOG(ERROR) << "*** send() to zygote failed"; |
171 } | 171 } |
172 } | 172 } |
173 CHECK(false); // This routine must not return | 173 CHECK(false); // This routine must not return |
174 } | 174 } |
OLD | NEW |