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 "chrome/common/nacl_helper_linux.h" |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <link.h> | 10 #include <link.h> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 * came in as our argv[0]. | 168 * came in as our argv[0]. |
169 */ | 169 */ |
170 struct link_map *l = _r_debug.r_map; | 170 struct link_map *l = _r_debug.r_map; |
171 if (l->l_name[0] == '\0') | 171 if (l->l_name[0] == '\0') |
172 l->l_name = argv0; | 172 l->l_name = argv0; |
173 } | 173 } |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 /* | 177 /* |
178 * The zygote passes --reserved_at_zero=0xXXXXXXXX. | 178 * The zygote passes --reserved_at_zero=0xXXXXXXXXXXXXXXXX. |
179 * nacl_helper_bootstrap replaces the Xs with the amount of prereserved | 179 * nacl_helper_bootstrap replaces the Xs with the amount of prereserved |
180 * sandbox memory. | 180 * sandbox memory. |
181 * | 181 * |
182 * CheckReservedAtZero parses the value of the argument reserved_at_zero | 182 * CheckReservedAtZero parses the value of the argument reserved_at_zero |
183 * and returns the amount of prereserved sandbox memory. | 183 * and returns the amount of prereserved sandbox memory. |
184 */ | 184 */ |
185 static size_t CheckReservedAtZero() { | 185 static size_t CheckReservedAtZero() { |
186 size_t prereserved_sandbox_size = 0; | 186 size_t prereserved_sandbox_size = 0; |
187 std::string reserved_at_zero_switch_value = | 187 std::string reserved_at_zero_switch_value = |
188 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 188 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 _exit(-1); | 259 _exit(-1); |
260 } | 260 } |
261 // if fork fails, send PID=-1 to zygote | 261 // if fork fails, send PID=-1 to zygote |
262 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, | 262 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, |
263 sizeof(badpid), empty)) { | 263 sizeof(badpid), empty)) { |
264 LOG(ERROR) << "*** send() to zygote failed"; | 264 LOG(ERROR) << "*** send() to zygote failed"; |
265 } | 265 } |
266 } | 266 } |
267 CHECK(false); // This routine must not return | 267 CHECK(false); // This routine must not return |
268 } | 268 } |
OLD | NEW |