chromium 11.0.969.72
[chromium.git] / patches / patch-base_process__util.h
1 $NetBSD$
2
3 --- base/process_util.h.orig    2011-05-24 08:01:33.000000000 +0000
4 +++ base/process_util.h
5 @@ -14,14 +14,20 @@
6  #if defined(OS_WIN)
7  #include <windows.h>
8  #include <tlhelp32.h>
9 -#elif defined(OS_MACOSX)
10 +#elif defined(OS_MACOSX) || defined(OS_BSD)
11  // kinfo_proc is defined in <sys/sysctl.h>, but this forward declaration
12  // is sufficient for the vector<kinfo_proc> below.
13 +#if defined(OS_NETBSD)
14 +struct kinfo_proc2;
15 +#else
16  struct kinfo_proc;
17 +#endif
18  // malloc_zone_t is defined in <malloc/malloc.h>, but this forward declaration
19  // is sufficient for GetPurgeableZone() below.
20  typedef struct _malloc_zone_t malloc_zone_t;
21 +#if defined(OS_MACOSX)
22  #include <mach/mach.h>
23 +#endif
24  #elif defined(OS_POSIX)
25  #include <dirent.h>
26  #include <limits.h>
27 @@ -161,10 +167,11 @@ void CloseProcessHandle(ProcessHandle pr
28  // Win XP SP1 as well.
29  ProcessId GetProcId(ProcessHandle process);
30  
31 -#if defined(OS_LINUX)
32 +#if defined(OS_LINUX) || defined(OS_BSD)
33  // Returns the path to the executable of the given process.
34  FilePath GetProcessExecutablePath(ProcessHandle process);
35  
36 +#elif defined(OS_LINUX)
37  // Parse the data found in /proc/<pid>/stat and return the sum of the
38  // CPU-related ticks.  Returns -1 on parse error.
39  // Exposed for testing.
40 @@ -439,8 +446,12 @@ class ProcessIterator {
41  #if defined(OS_WIN)
42    HANDLE snapshot_;
43    bool started_iteration_;
44 -#elif defined(OS_MACOSX)
45 +#elif defined(OS_MACOSX) || defined(OS_BSD)
46 +#if defined(OS_NETBSD)
47 +  std::vector<kinfo_proc2> kinfo_procs_;
48 +#else
49    std::vector<kinfo_proc> kinfo_procs_;
50 +#endif
51    size_t index_of_kinfo_proc_;
52  #elif defined(OS_POSIX)
53    DIR *procfs_dir_;