| 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 // This file contains routines to kill processes and get the exit code and | 5 // This file contains routines to kill processes and get the exit code and |
| 6 // termination status. | 6 // termination status. |
| 7 | 7 |
| 8 #ifndef BASE_PROCESS_KILL_H_ | 8 #ifndef BASE_PROCESS_KILL_H_ |
| 9 #define BASE_PROCESS_KILL_H_ | 9 #define BASE_PROCESS_KILL_H_ |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/process/process.h" | 12 #include "base/process/process.h" |
| 13 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 | 17 |
| 18 class ProcessFilter; | 18 class ProcessFilter; |
| 19 | 19 |
| 20 // Return status values from GetTerminationStatus. Don't use these as | 20 // Return status values from GetTerminationStatus. Don't use these as |
| 21 // exit code arguments to KillProcess*(), use platform/application | 21 // exit code arguments to KillProcess*(), use platform/application |
| 22 // specific values instead. | 22 // specific values instead. |
| 23 enum TerminationStatus { | 23 enum TerminationStatus { |
| 24 TERMINATION_STATUS_NORMAL_TERMINATION, // zero exit status | 24 TERMINATION_STATUS_NORMAL_TERMINATION, // zero exit status |
| 25 TERMINATION_STATUS_ABNORMAL_TERMINATION, // non-zero exit status | 25 TERMINATION_STATUS_ABNORMAL_TERMINATION, // non-zero exit status |
| 26 TERMINATION_STATUS_PROCESS_WAS_KILLED, // e.g. SIGKILL or task manager kill | 26 TERMINATION_STATUS_PROCESS_WAS_KILLED, // e.g. SIGKILL or task manager kill |
| 27 TERMINATION_STATUS_PROCESS_CRASHED, // e.g. Segmentation fault | 27 TERMINATION_STATUS_PROCESS_CRASHED, // e.g. Segmentation fault |
| 28 TERMINATION_STATUS_STILL_RUNNING, // child hasn't exited yet | 28 TERMINATION_STATUS_STILL_RUNNING, // child hasn't exited yet |
| 29 #if defined(OS_CHROMEOS) |
| 30 // Used for the case when oom-killer kills a process on ChromeOS. |
| 31 TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM, |
| 32 #endif |
| 29 #if defined(OS_ANDROID) | 33 #if defined(OS_ANDROID) |
| 30 // On Android processes are spawned from the system Zygote and we do not get | 34 // On Android processes are spawned from the system Zygote and we do not get |
| 31 // the termination status. We can't know if the termination was a crash or an | 35 // the termination status. We can't know if the termination was a crash or an |
| 32 // oom kill for sure, but we can use status of the strong process bindings as | 36 // oom kill for sure, but we can use status of the strong process bindings as |
| 33 // a hint. | 37 // a hint. |
| 34 TERMINATION_STATUS_OOM_PROTECTED, // child was protected from oom kill | 38 TERMINATION_STATUS_OOM_PROTECTED, // child was protected from oom kill |
| 35 #endif | 39 #endif |
| 36 TERMINATION_STATUS_MAX_ENUM | 40 TERMINATION_STATUS_MAX_ENUM |
| 37 }; | 41 }; |
| 38 | 42 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 124 |
| 121 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 125 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 122 // The nicer version of EnsureProcessTerminated() that is patient and will | 126 // The nicer version of EnsureProcessTerminated() that is patient and will |
| 123 // wait for |pid| to finish and then reap it. | 127 // wait for |pid| to finish and then reap it. |
| 124 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); | 128 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); |
| 125 #endif | 129 #endif |
| 126 | 130 |
| 127 } // namespace base | 131 } // namespace base |
| 128 | 132 |
| 129 #endif // BASE_PROCESS_KILL_H_ | 133 #endif // BASE_PROCESS_KILL_H_ |
| OLD | NEW |