| 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 <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 if (!child_info.started_from_helper) { | 241 if (!child_info.started_from_helper) { |
| 242 // Do not call base::EnsureProcessTerminated() under ThreadSanitizer, as it | 242 // Do not call base::EnsureProcessTerminated() under ThreadSanitizer, as it |
| 243 // spawns a separate thread which may live until the call to fork() in the | 243 // spawns a separate thread which may live until the call to fork() in the |
| 244 // zygote. As a result, ThreadSanitizer will report an error and almost | 244 // zygote. As a result, ThreadSanitizer will report an error and almost |
| 245 // disable race detection in the child process. | 245 // disable race detection in the child process. |
| 246 // Not calling EnsureProcessTerminated() may result in zombie processes | 246 // Not calling EnsureProcessTerminated() may result in zombie processes |
| 247 // sticking around. This will only happen during testing, so we can live | 247 // sticking around. This will only happen during testing, so we can live |
| 248 // with this for now. | 248 // with this for now. |
| 249 #if !defined(THREAD_SANITIZER) | 249 #if !defined(THREAD_SANITIZER) |
| 250 // TODO(jln): this old code is completely broken. See crbug.com/274855. | 250 // TODO(jln): this old code is completely broken. See crbug.com/274855. |
| 251 base::EnsureProcessTerminated(child_info.internal_pid); | 251 base::EnsureProcessTerminated(base::Process(child_info.internal_pid)); |
| 252 #else | 252 #else |
| 253 LOG(WARNING) << "Zygote process omitting a call to " | 253 LOG(WARNING) << "Zygote process omitting a call to " |
| 254 << "base::EnsureProcessTerminated() for child pid " << child | 254 << "base::EnsureProcessTerminated() for child pid " << child |
| 255 << " under ThreadSanitizer. See http://crbug.com/274855."; | 255 << " under ThreadSanitizer. See http://crbug.com/274855."; |
| 256 #endif | 256 #endif |
| 257 } else { | 257 } else { |
| 258 // For processes from the helper, send a GetTerminationStatus request | 258 // For processes from the helper, send a GetTerminationStatus request |
| 259 // with known_dead set to true. | 259 // with known_dead set to true. |
| 260 // This is not perfect, as the process may be killed instantly, but is | 260 // This is not perfect, as the process may be killed instantly, but is |
| 261 // better than ignoring the request. | 261 // better than ignoring the request. |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 PickleIterator iter) { | 585 PickleIterator iter) { |
| 586 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 586 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
| 587 sizeof(sandbox_flags_)) { | 587 sizeof(sandbox_flags_)) { |
| 588 PLOG(ERROR) << "write"; | 588 PLOG(ERROR) << "write"; |
| 589 } | 589 } |
| 590 | 590 |
| 591 return false; | 591 return false; |
| 592 } | 592 } |
| 593 | 593 |
| 594 } // namespace content | 594 } // namespace content |
| OLD | NEW |