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 methods to iterate over processes on the system. | 5 // This file contains methods to iterate over processes on the system. |
6 | 6 |
7 #ifndef BASE_PROCESS_PROCESS_ITERATOR_H_ | 7 #ifndef BASE_PROCESS_PROCESS_ITERATOR_H_ |
8 #define BASE_PROCESS_PROCESS_ITERATOR_H_ | 8 #define BASE_PROCESS_PROCESS_ITERATOR_H_ |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/process/process.h" | 17 #include "base/process/process.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 | 19 |
20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
21 #include <windows.h> | 21 #include <windows.h> |
22 #include <tlhelp32.h> | 22 #include <tlhelp32.h> |
23 #elif defined(OS_MACOSX) || defined(OS_BSD) | 23 #elif defined(OS_MACOSX) || defined(OS_OPENBSD) |
24 #include <sys/sysctl.h> | 24 #include <sys/sysctl.h> |
| 25 #elif defined(OS_FREEBSD) |
| 26 #include <sys/user.h> |
25 #elif defined(OS_POSIX) | 27 #elif defined(OS_POSIX) |
26 #include <dirent.h> | 28 #include <dirent.h> |
27 #endif | 29 #endif |
28 | 30 |
29 namespace base { | 31 namespace base { |
30 | 32 |
31 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
32 struct ProcessEntry : public PROCESSENTRY32 { | 34 struct ProcessEntry : public PROCESSENTRY32 { |
33 ProcessId pid() const { return th32ProcessID; } | 35 ProcessId pid() const { return th32ProcessID; } |
34 ProcessId parent_pid() const { return th32ParentProcessID; } | 36 ProcessId parent_pid() const { return th32ParentProcessID; } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 176 |
175 // Returns the number of processes on the machine that are running from the | 177 // Returns the number of processes on the machine that are running from the |
176 // given executable name. If filter is non-null, then only processes selected | 178 // given executable name. If filter is non-null, then only processes selected |
177 // by the filter will be counted. | 179 // by the filter will be counted. |
178 BASE_EXPORT int GetProcessCount(const FilePath::StringType& executable_name, | 180 BASE_EXPORT int GetProcessCount(const FilePath::StringType& executable_name, |
179 const ProcessFilter* filter); | 181 const ProcessFilter* filter); |
180 | 182 |
181 } // namespace base | 183 } // namespace base |
182 | 184 |
183 #endif // BASE_PROCESS_PROCESS_ITERATOR_H_ | 185 #endif // BASE_PROCESS_PROCESS_ITERATOR_H_ |
OLD | NEW |