Chromium Code Reviews| Index: base/process_util_posix.cc |
| diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc |
| index 8e6781e553000a75ce178f5965af5ecca68cf4aa..87a4e36ae88d4874859ce2989838a9a040d24e42 100644 |
| --- a/base/process_util_posix.cc |
| +++ b/base/process_util_posix.cc |
| @@ -97,6 +97,31 @@ void RaiseProcessToHighPriority() { |
| // setpriority() or sched_getscheduler, but these all require extra rights. |
| } |
| +bool DidProcessCrash(ProcessHandle handle) { |
| + int status; |
| + if (waitpid(handle, &status, WNOHANG)) { |
| + // I feel like dancing! |
| + return false; |
| + } |
| + |
| + if (WIFSIGNALED(status)) { |
| + switch(WTERMSIG(status)) { |
| + case SIGSEGV: |
|
Mark Mentovai
2009/01/21 14:20:22
SIGBUS?
|
| + case SIGILL: |
| + case SIGABRT: |
| + case SIGFPE: |
| + return true; |
| + default: |
| + return false; |
| + } |
| + } |
| + |
| + if (WIFEXITED(status)) |
| + return WEXITSTATUS(status) != 0; |
|
Mark Mentovai
2009/01/21 14:20:22
That's not really a crash, though...
|
| + |
| + return false; |
| +} |
| + |
| bool WaitForExitCode(ProcessHandle handle, int* exit_code) { |
| int status; |
| while (waitpid(handle, &status, 0) == -1) { |