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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 BASE_EXPORT bool KillProcesses(const FilePath::StringType& executable_name, | 43 BASE_EXPORT bool KillProcesses(const FilePath::StringType& executable_name, |
44 int exit_code, | 44 int exit_code, |
45 const ProcessFilter* filter); | 45 const ProcessFilter* filter); |
46 | 46 |
47 // Attempts to kill the process identified by the given process | 47 // Attempts to kill the process identified by the given process |
48 // entry structure, giving it the specified exit code. If |wait| is true, wait | 48 // entry structure, giving it the specified exit code. If |wait| is true, wait |
49 // for the process to be actually terminated before returning. | 49 // for the process to be actually terminated before returning. |
50 // Returns true if this is successful, false otherwise. | 50 // Returns true if this is successful, false otherwise. |
51 BASE_EXPORT bool KillProcess(ProcessHandle process, int exit_code, bool wait); | 51 BASE_EXPORT bool KillProcess(ProcessHandle process, int exit_code, bool wait); |
52 | 52 |
| 53 #if defined(OS_WIN) |
| 54 // Attempts to kill all processes associated with the job identified by the |
| 55 // given job handle, giving them the specified exit code. If |wait| is true, |
| 56 // wait for the job to be actually terminated before returning. |
| 57 // Returns true if this is successful, false otherwise. |
| 58 BASE_EXPORT bool KillJob(HANDLE job, int exit_code, bool wait); |
| 59 #endif // defined(OS_WIN) |
| 60 |
53 #if defined(OS_POSIX) | 61 #if defined(OS_POSIX) |
54 // Attempts to kill the process group identified by |process_group_id|. Returns | 62 // Attempts to kill the process group identified by |process_group_id|. Returns |
55 // true on success. | 63 // true on success. |
56 BASE_EXPORT bool KillProcessGroup(ProcessHandle process_group_id); | 64 BASE_EXPORT bool KillProcessGroup(ProcessHandle process_group_id); |
57 #endif // defined(OS_POSIX) | 65 #endif // defined(OS_POSIX) |
58 | 66 |
59 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
60 BASE_EXPORT bool KillProcessById(ProcessId process_id, | 68 BASE_EXPORT bool KillProcessById(ProcessId process_id, |
61 int exit_code, | 69 int exit_code, |
62 bool wait); | 70 bool wait); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 161 |
154 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 162 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
155 // The nicer version of EnsureProcessTerminated() that is patient and will | 163 // The nicer version of EnsureProcessTerminated() that is patient and will |
156 // wait for |process_handle| to finish and then reap it. | 164 // wait for |process_handle| to finish and then reap it. |
157 BASE_EXPORT void EnsureProcessGetsReaped(ProcessHandle process_handle); | 165 BASE_EXPORT void EnsureProcessGetsReaped(ProcessHandle process_handle); |
158 #endif | 166 #endif |
159 | 167 |
160 } // namespace base | 168 } // namespace base |
161 | 169 |
162 #endif // BASE_PROCESS_KILL_H_ | 170 #endif // BASE_PROCESS_KILL_H_ |
OLD | NEW |