Chromium Code Reviews| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 if (msglen == sizeof(kNaClForkRequest) - 1 && | 227 if (msglen == sizeof(kNaClForkRequest) - 1 && |
| 228 memcmp(buf, kNaClForkRequest, msglen) == 0) { | 228 memcmp(buf, kNaClForkRequest, msglen) == 0) { |
| 229 if (kNaClParentFDIndex + 1 == fds.size()) { | 229 if (kNaClParentFDIndex + 1 == fds.size()) { |
| 230 HandleForkRequest(fds, prereserved_sandbox_size); | 230 HandleForkRequest(fds, prereserved_sandbox_size); |
| 231 continue; // fork succeeded. Note: child does not return | 231 continue; // fork succeeded. Note: child does not return |
| 232 } else { | 232 } else { |
| 233 LOG(ERROR) << "nacl_helper: unexpected number of fds, got " | 233 LOG(ERROR) << "nacl_helper: unexpected number of fds, got " |
| 234 << fds.size(); | 234 << fds.size(); |
| 235 } | 235 } |
| 236 } else { | 236 } else { |
| 237 if (msglen != 0) { | 237 if (msglen > 0) { |
|
Mark Seaborn
2012/07/09 09:19:05
">=" would be more appropriate than ">" since errn
halyavin
2012/07/09 10:55:56
Done.
| |
| 238 LOG(ERROR) << "nacl_helper unrecognized request: %s"; | 238 LOG(ERROR) << "nacl_helper unrecognized request: " |
| 239 << std::string(buf, buf + msglen); | |
|
Mark Seaborn
2012/07/09 09:19:05
Is this appropriate, given that the buffer might c
halyavin
2012/07/09 10:55:56
We will print zeros then. They will not be visible
Mark Seaborn
2012/07/10 16:10:05
That's kind of icky. Maybe you could use GetDoubl
| |
| 239 _exit(-1); | 240 _exit(-1); |
| 241 } else { | |
| 242 LOG(ERROR) << "receive from zygote failed, errno = " << errno; | |
|
Mark Seaborn
2012/07/09 09:19:05
Prefix this with "nacl_helper:"?
halyavin
2012/07/09 10:55:56
Done.
| |
| 240 } | 243 } |
| 241 } | 244 } |
| 242 // if fork fails, send PID=-1 to zygote | 245 // if fork fails, send PID=-1 to zygote |
| 243 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, | 246 if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, |
| 244 sizeof(badpid), empty)) { | 247 sizeof(badpid), empty)) { |
| 245 LOG(ERROR) << "*** send() to zygote failed"; | 248 LOG(ERROR) << "*** send() to zygote failed"; |
| 246 } | 249 } |
| 247 } | 250 } |
| 248 CHECK(false); // This routine must not return | 251 CHECK(false); // This routine must not return |
| 249 } | 252 } |
| OLD | NEW |