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 #include "content/zygote/zygote_linux.h" | 5 #include "content/zygote/zygote_linux.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <poll.h> | 9 #include <poll.h> |
10 #include <signal.h> | 10 #include <signal.h> |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 | 231 |
232 bool Zygote::HandleRequestFromBrowser(int fd) { | 232 bool Zygote::HandleRequestFromBrowser(int fd) { |
233 std::vector<base::ScopedFD> fds; | 233 std::vector<base::ScopedFD> fds; |
234 char buf[kZygoteMaxMessageLength]; | 234 char buf[kZygoteMaxMessageLength]; |
235 const ssize_t len = base::UnixDomainSocket::RecvMsg( | 235 const ssize_t len = base::UnixDomainSocket::RecvMsg( |
236 fd, buf, sizeof(buf), &fds); | 236 fd, buf, sizeof(buf), &fds); |
237 | 237 |
238 if (len == 0 || (len == -1 && errno == ECONNRESET)) { | 238 if (len == 0 || (len == -1 && errno == ECONNRESET)) { |
239 // EOF from the browser. We should die. | 239 // EOF from the browser. We should die. |
240 // TODO(earthdok): call __sanititizer_cov_dump() here to obtain code | 240 // TODO(eugenis): call __sanititizer_cov_dump() here to obtain code |
241 // coverage for the Zygote. Currently it's not possible because of | 241 // coverage for the Zygote. Currently it's not possible because of |
242 // confusion over who is responsible for closing the file descriptor. | 242 // confusion over who is responsible for closing the file descriptor. |
243 for (int fd : extra_fds_) { | 243 for (int fd : extra_fds_) { |
244 PCHECK(0 == IGNORE_EINTR(close(fd))); | 244 PCHECK(0 == IGNORE_EINTR(close(fd))); |
245 } | 245 } |
246 #if !defined(SANITIZER_COVERAGE) | 246 #if !defined(SANITIZER_COVERAGE) |
247 // TODO(earthdok): add watchdog thread before using this in builds not | 247 // TODO(eugenis): add watchdog thread before using this in builds not |
248 // using sanitizer coverage. | 248 // using sanitizer coverage. |
249 CHECK(extra_children_.empty()); | 249 CHECK(extra_children_.empty()); |
250 #endif | 250 #endif |
251 for (base::ProcessHandle pid : extra_children_) { | 251 for (base::ProcessHandle pid : extra_children_) { |
252 PCHECK(pid == HANDLE_EINTR(waitpid(pid, NULL, 0))); | 252 PCHECK(pid == HANDLE_EINTR(waitpid(pid, NULL, 0))); |
253 } | 253 } |
254 _exit(0); | 254 _exit(0); |
255 return false; | 255 return false; |
256 } | 256 } |
257 | 257 |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { | 665 bool Zygote::HandleGetSandboxStatus(int fd, base::PickleIterator iter) { |
666 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 666 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
667 sizeof(sandbox_flags_)) { | 667 sizeof(sandbox_flags_)) { |
668 PLOG(ERROR) << "write"; | 668 PLOG(ERROR) << "write"; |
669 } | 669 } |
670 | 670 |
671 return false; | 671 return false; |
672 } | 672 } |
673 | 673 |
674 } // namespace content | 674 } // namespace content |
OLD | NEW |