OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/process/kill.h" | 5 #include "base/process/kill.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <sys/wait.h> | 9 #include <sys/wait.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 *exit_code = status; | 43 *exit_code = status; |
44 | 44 |
45 if (WIFSIGNALED(status)) { | 45 if (WIFSIGNALED(status)) { |
46 switch (WTERMSIG(status)) { | 46 switch (WTERMSIG(status)) { |
47 case SIGABRT: | 47 case SIGABRT: |
48 case SIGBUS: | 48 case SIGBUS: |
49 case SIGFPE: | 49 case SIGFPE: |
50 case SIGILL: | 50 case SIGILL: |
51 case SIGSEGV: | 51 case SIGSEGV: |
52 return TERMINATION_STATUS_PROCESS_CRASHED; | 52 return TERMINATION_STATUS_PROCESS_CRASHED; |
| 53 case SIGKILL: |
| 54 #if defined(OS_CHROMEOS) |
| 55 // On ChromeOS, only way a process gets kill by SIGKILL |
| 56 // is by oom-killer. |
| 57 return TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM; |
| 58 #endif |
53 case SIGINT: | 59 case SIGINT: |
54 case SIGKILL: | |
55 case SIGTERM: | 60 case SIGTERM: |
56 return TERMINATION_STATUS_PROCESS_WAS_KILLED; | 61 return TERMINATION_STATUS_PROCESS_WAS_KILLED; |
57 default: | 62 default: |
58 break; | 63 break; |
59 } | 64 } |
60 } | 65 } |
61 | 66 |
62 if (WIFEXITED(status) && WEXITSTATUS(status) != 0) | 67 if (WIFEXITED(status) && WEXITSTATUS(status) != 0) |
63 return TERMINATION_STATUS_ABNORMAL_TERMINATION; | 68 return TERMINATION_STATUS_ABNORMAL_TERMINATION; |
64 | 69 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return; | 220 return; |
216 | 221 |
217 BackgroundReaper* reaper = new BackgroundReaper(pid, 0); | 222 BackgroundReaper* reaper = new BackgroundReaper(pid, 0); |
218 PlatformThread::CreateNonJoinable(0, reaper); | 223 PlatformThread::CreateNonJoinable(0, reaper); |
219 } | 224 } |
220 | 225 |
221 #endif // !defined(OS_MACOSX) | 226 #endif // !defined(OS_MACOSX) |
222 #endif // !defined(OS_NACL_NONSFI) | 227 #endif // !defined(OS_NACL_NONSFI) |
223 | 228 |
224 } // namespace base | 229 } // namespace base |
OLD | NEW |