| 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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // Attempts to kill all the processes on the current machine that were launched | 39 // Attempts to kill all the processes on the current machine that were launched |
| 40 // from the given executable name, ending them with the given exit code. If | 40 // from the given executable name, ending them with the given exit code. If |
| 41 // filter is non-null, then only processes selected by the filter are killed. | 41 // filter is non-null, then only processes selected by the filter are killed. |
| 42 // Returns true if all processes were able to be killed off, false if at least | 42 // Returns true if all processes were able to be killed off, false if at least |
| 43 // one couldn't be killed. | 43 // one couldn't be killed. |
| 44 BASE_EXPORT bool KillProcesses(const FilePath::StringType& executable_name, | 44 BASE_EXPORT bool KillProcesses(const FilePath::StringType& executable_name, |
| 45 int exit_code, | 45 int exit_code, |
| 46 const ProcessFilter* filter); | 46 const ProcessFilter* filter); |
| 47 | 47 |
| 48 // Attempts to kill the process identified by the given process | |
| 49 // entry structure, giving it the specified exit code. If |wait| is true, wait | |
| 50 // for the process to be actually terminated before returning. | |
| 51 // Returns true if this is successful, false otherwise. | |
| 52 BASE_EXPORT bool KillProcess(ProcessHandle process, int exit_code, bool wait); | |
| 53 | |
| 54 #if defined(OS_POSIX) | 48 #if defined(OS_POSIX) |
| 55 // Attempts to kill the process group identified by |process_group_id|. Returns | 49 // Attempts to kill the process group identified by |process_group_id|. Returns |
| 56 // true on success. | 50 // true on success. |
| 57 BASE_EXPORT bool KillProcessGroup(ProcessHandle process_group_id); | 51 BASE_EXPORT bool KillProcessGroup(ProcessHandle process_group_id); |
| 58 #endif // defined(OS_POSIX) | 52 #endif // defined(OS_POSIX) |
| 59 | 53 |
| 60 // Get the termination status of the process by interpreting the | 54 // Get the termination status of the process by interpreting the |
| 61 // circumstances of the child process' death. |exit_code| is set to | 55 // circumstances of the child process' death. |exit_code| is set to |
| 62 // the status returned by waitpid() on POSIX, and from | 56 // the status returned by waitpid() on POSIX, and from |
| 63 // GetExitCodeProcess() on Windows. |exit_code| may be NULL if the | 57 // GetExitCodeProcess() on Windows. |exit_code| may be NULL if the |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 120 |
| 127 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 121 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 128 // The nicer version of EnsureProcessTerminated() that is patient and will | 122 // The nicer version of EnsureProcessTerminated() that is patient and will |
| 129 // wait for |pid| to finish and then reap it. | 123 // wait for |pid| to finish and then reap it. |
| 130 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); | 124 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); |
| 131 #endif | 125 #endif |
| 132 | 126 |
| 133 } // namespace base | 127 } // namespace base |
| 134 | 128 |
| 135 #endif // BASE_PROCESS_KILL_H_ | 129 #endif // BASE_PROCESS_KILL_H_ |
| OLD | NEW |