OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/namespace contains utility functions for enumerating, ending and | 5 // This file/namespace contains utility functions for enumerating, ending and |
6 // computing statistics of processes. | 6 // computing statistics of processes. |
7 | 7 |
8 #ifndef BASE_PROCESS_UTIL_H_ | 8 #ifndef BASE_PROCESS_UTIL_H_ |
9 #define BASE_PROCESS_UTIL_H_ | 9 #define BASE_PROCESS_UTIL_H_ |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Returns the id of the current process. | 64 // Returns the id of the current process. |
65 ProcessId GetCurrentProcId(); | 65 ProcessId GetCurrentProcId(); |
66 | 66 |
67 // Returns the ProcessHandle of the current process. | 67 // Returns the ProcessHandle of the current process. |
68 ProcessHandle GetCurrentProcessHandle(); | 68 ProcessHandle GetCurrentProcessHandle(); |
69 | 69 |
70 // Converts a PID to a process handle. This handle must be closed by | 70 // Converts a PID to a process handle. This handle must be closed by |
71 // CloseProcessHandle when you are done with it. Returns true on success. | 71 // CloseProcessHandle when you are done with it. Returns true on success. |
72 bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle); | 72 bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle); |
73 | 73 |
| 74 // Converts a PID to a process handle. On Windows the handle is opened |
| 75 // with more access rights and must only be used by trusted code. |
| 76 // You have to close returned handle using CloseProcessHandle. Returns true |
| 77 // on success. |
| 78 bool OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle); |
| 79 |
74 // Closes the process handle opened by OpenProcessHandle. | 80 // Closes the process handle opened by OpenProcessHandle. |
75 void CloseProcessHandle(ProcessHandle process); | 81 void CloseProcessHandle(ProcessHandle process); |
76 | 82 |
77 // Returns the unique ID for the specified process. This is functionally the | 83 // Returns the unique ID for the specified process. This is functionally the |
78 // same as Windows' GetProcessId(), but works on versions of Windows before | 84 // same as Windows' GetProcessId(), but works on versions of Windows before |
79 // Win XP SP1 as well. | 85 // Win XP SP1 as well. |
80 ProcessId GetProcId(ProcessHandle process); | 86 ProcessId GetProcId(ProcessHandle process); |
81 | 87 |
82 #if defined(OS_POSIX) | 88 #if defined(OS_POSIX) |
83 // Sets all file descriptors to close on exec except for stdin, stdout | 89 // Sets all file descriptors to close on exec except for stdin, stdout |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // overflow. Has no effect if the OS doesn't provide the necessary facility. | 374 // overflow. Has no effect if the OS doesn't provide the necessary facility. |
369 void EnableTerminationOnHeapCorruption(); | 375 void EnableTerminationOnHeapCorruption(); |
370 | 376 |
371 // If supported on the platform, and the user has sufficent rights, increase | 377 // If supported on the platform, and the user has sufficent rights, increase |
372 // the current process's scheduling priority to a high priority. | 378 // the current process's scheduling priority to a high priority. |
373 void RaiseProcessToHighPriority(); | 379 void RaiseProcessToHighPriority(); |
374 | 380 |
375 } // namespace base | 381 } // namespace base |
376 | 382 |
377 #endif // BASE_PROCESS_UTIL_H_ | 383 #endif // BASE_PROCESS_UTIL_H_ |
OLD | NEW |