| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <dirent.h> | 5 #include <dirent.h> |
| 6 #include <errno.h> | 6 #include <errno.h> |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 void RaiseProcessToHighPriority() { | 323 void RaiseProcessToHighPriority() { |
| 324 // On POSIX, we don't actually do anything here. We could try to nice() or | 324 // On POSIX, we don't actually do anything here. We could try to nice() or |
| 325 // setpriority() or sched_getscheduler, but these all require extra rights. | 325 // setpriority() or sched_getscheduler, but these all require extra rights. |
| 326 } | 326 } |
| 327 | 327 |
| 328 bool DidProcessCrash(bool* child_exited, ProcessHandle handle) { | 328 bool DidProcessCrash(bool* child_exited, ProcessHandle handle) { |
| 329 int status; | 329 int status; |
| 330 const int result = HANDLE_EINTR(waitpid(handle, &status, WNOHANG)); | 330 const int result = HANDLE_EINTR(waitpid(handle, &status, WNOHANG)); |
| 331 if (result == -1) { | 331 if (result == -1) { |
| 332 LOG(ERROR) << "waitpid failed pid:" << handle << " errno:" << errno; | 332 LOG(ERROR) << "waitpid(" << handle << "): " << strerror(errno); |
| 333 if (child_exited) | 333 if (child_exited) |
| 334 *child_exited = false; | 334 *child_exited = false; |
| 335 return false; | 335 return false; |
| 336 } else if (result == 0) { | 336 } else if (result == 0) { |
| 337 // the child hasn't exited yet. | 337 // the child hasn't exited yet. |
| 338 if (child_exited) | 338 if (child_exited) |
| 339 *child_exited = false; | 339 *child_exited = false; |
| 340 return false; | 340 return false; |
| 341 } | 341 } |
| 342 | 342 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 const ProcessFilter* filter) { | 635 const ProcessFilter* filter) { |
| 636 bool exited_cleanly = | 636 bool exited_cleanly = |
| 637 WaitForProcessesToExit(executable_name, wait_milliseconds, | 637 WaitForProcessesToExit(executable_name, wait_milliseconds, |
| 638 filter); | 638 filter); |
| 639 if (!exited_cleanly) | 639 if (!exited_cleanly) |
| 640 KillProcesses(executable_name, exit_code, filter); | 640 KillProcesses(executable_name, exit_code, filter); |
| 641 return exited_cleanly; | 641 return exited_cleanly; |
| 642 } | 642 } |
| 643 | 643 |
| 644 } // namespace base | 644 } // namespace base |
| OLD | NEW |