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 |
(...skipping 21 matching lines...) Expand all Loading... |
32 TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM, | 32 TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM, |
33 #endif | 33 #endif |
34 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
35 // On Android processes are spawned from the system Zygote and we do not get | 35 // On Android processes are spawned from the system Zygote and we do not get |
36 // the termination status. We can't know if the termination was a crash or an | 36 // the termination status. We can't know if the termination was a crash or an |
37 // oom kill for sure, but we can use status of the strong process bindings as | 37 // oom kill for sure, but we can use status of the strong process bindings as |
38 // a hint. | 38 // a hint. |
39 TERMINATION_STATUS_OOM_PROTECTED, // child was protected from oom kill | 39 TERMINATION_STATUS_OOM_PROTECTED, // child was protected from oom kill |
40 #endif | 40 #endif |
41 TERMINATION_STATUS_LAUNCH_FAILED, // child process never launched | 41 TERMINATION_STATUS_LAUNCH_FAILED, // child process never launched |
| 42 TERMINATION_STATUS_OOM, // Process died due to oom |
42 TERMINATION_STATUS_MAX_ENUM | 43 TERMINATION_STATUS_MAX_ENUM |
43 }; | 44 }; |
44 | 45 |
45 // Attempts to kill all the processes on the current machine that were launched | 46 // Attempts to kill all the processes on the current machine that were launched |
46 // from the given executable name, ending them with the given exit code. If | 47 // from the given executable name, ending them with the given exit code. If |
47 // filter is non-null, then only processes selected by the filter are killed. | 48 // filter is non-null, then only processes selected by the filter are killed. |
48 // Returns true if all processes were able to be killed off, false if at least | 49 // Returns true if all processes were able to be killed off, false if at least |
49 // one couldn't be killed. | 50 // one couldn't be killed. |
50 BASE_EXPORT bool KillProcesses(const FilePath::StringType& executable_name, | 51 BASE_EXPORT bool KillProcesses(const FilePath::StringType& executable_name, |
51 int exit_code, | 52 int exit_code, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 127 |
127 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 128 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
128 // The nicer version of EnsureProcessTerminated() that is patient and will | 129 // The nicer version of EnsureProcessTerminated() that is patient and will |
129 // wait for |pid| to finish and then reap it. | 130 // wait for |pid| to finish and then reap it. |
130 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); | 131 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); |
131 #endif | 132 #endif |
132 | 133 |
133 } // namespace base | 134 } // namespace base |
134 | 135 |
135 #endif // BASE_PROCESS_KILL_H_ | 136 #endif // BASE_PROCESS_KILL_H_ |
OLD | NEW |