| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // for the process to be actually terminated before returning. | 50 // for the process to be actually terminated before returning. |
| 51 // Returns true if this is successful, false otherwise. | 51 // Returns true if this is successful, false otherwise. |
| 52 BASE_EXPORT bool KillProcess(ProcessHandle process, int exit_code, bool wait); | 52 BASE_EXPORT bool KillProcess(ProcessHandle process, int exit_code, bool wait); |
| 53 | 53 |
| 54 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
| 55 // Attempts to kill the process group identified by |process_group_id|. Returns | 55 // Attempts to kill the process group identified by |process_group_id|. Returns |
| 56 // true on success. | 56 // true on success. |
| 57 BASE_EXPORT bool KillProcessGroup(ProcessHandle process_group_id); | 57 BASE_EXPORT bool KillProcessGroup(ProcessHandle process_group_id); |
| 58 #endif // defined(OS_POSIX) | 58 #endif // defined(OS_POSIX) |
| 59 | 59 |
| 60 #if defined(OS_WIN) | |
| 61 BASE_EXPORT bool KillProcessById(ProcessId process_id, | |
| 62 int exit_code, | |
| 63 bool wait); | |
| 64 #endif // defined(OS_WIN) | |
| 65 | |
| 66 // Get the termination status of the process by interpreting the | 60 // Get the termination status of the process by interpreting the |
| 67 // circumstances of the child process' death. |exit_code| is set to | 61 // circumstances of the child process' death. |exit_code| is set to |
| 68 // the status returned by waitpid() on POSIX, and from | 62 // the status returned by waitpid() on POSIX, and from |
| 69 // GetExitCodeProcess() on Windows. |exit_code| may be NULL if the | 63 // GetExitCodeProcess() on Windows. |exit_code| may be NULL if the |
| 70 // caller is not interested in it. Note that on Linux, this function | 64 // caller is not interested in it. Note that on Linux, this function |
| 71 // will only return a useful result the first time it is called after | 65 // will only return a useful result the first time it is called after |
| 72 // the child exits (because it will reap the child and the information | 66 // the child exits (because it will reap the child and the information |
| 73 // will no longer be available). | 67 // will no longer be available). |
| 74 BASE_EXPORT TerminationStatus GetTerminationStatus(ProcessHandle handle, | 68 BASE_EXPORT TerminationStatus GetTerminationStatus(ProcessHandle handle, |
| 75 int* exit_code); | 69 int* exit_code); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 126 |
| 133 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 127 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 134 // The nicer version of EnsureProcessTerminated() that is patient and will | 128 // The nicer version of EnsureProcessTerminated() that is patient and will |
| 135 // wait for |pid| to finish and then reap it. | 129 // wait for |pid| to finish and then reap it. |
| 136 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); | 130 BASE_EXPORT void EnsureProcessGetsReaped(ProcessId pid); |
| 137 #endif | 131 #endif |
| 138 | 132 |
| 139 } // namespace base | 133 } // namespace base |
| 140 | 134 |
| 141 #endif // BASE_PROCESS_KILL_H_ | 135 #endif // BASE_PROCESS_KILL_H_ |
| OLD | NEW |