Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: base/process_util.h

Issue 119289: Enable zygote manager by default. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/logging.cc ('k') | base/process_util_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 12
13 #if defined(OS_WIN) 13 #if defined(OS_WIN)
14 #include <windows.h> 14 #include <windows.h>
15 #include <tlhelp32.h> 15 #include <tlhelp32.h>
16 #elif defined(OS_LINUX) 16 #elif defined(OS_LINUX)
17 #include <dirent.h> 17 #include <dirent.h>
18 #include <limits.h> 18 #include <limits.h>
19 #include <sys/types.h> 19 #include <sys/types.h>
20 #endif 20 #endif
21 21
22 #include <string> 22 #include <string>
23 #include <vector> 23 #include <vector>
24 24
25 #include "base/command_line.h" 25 #include "base/command_line.h"
26 #include "base/file_path.h"
26 #include "base/process.h" 27 #include "base/process.h"
27 28
28 #if defined(OS_WIN) 29 #if defined(OS_WIN)
29 typedef PROCESSENTRY32 ProcessEntry; 30 typedef PROCESSENTRY32 ProcessEntry;
30 typedef IO_COUNTERS IoCounters; 31 typedef IO_COUNTERS IoCounters;
31 #elif defined(OS_POSIX) 32 #elif defined(OS_POSIX)
32 // TODO(port): we should not rely on a Win32 structure. 33 // TODO(port): we should not rely on a Win32 structure.
33 struct ProcessEntry { 34 struct ProcessEntry {
34 int pid; 35 int pid;
35 int ppid; 36 int ppid;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 bool OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle); 81 bool OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle);
81 82
82 // Closes the process handle opened by OpenProcessHandle. 83 // Closes the process handle opened by OpenProcessHandle.
83 void CloseProcessHandle(ProcessHandle process); 84 void CloseProcessHandle(ProcessHandle process);
84 85
85 // Returns the unique ID for the specified process. This is functionally the 86 // Returns the unique ID for the specified process. This is functionally the
86 // same as Windows' GetProcessId(), but works on versions of Windows before 87 // same as Windows' GetProcessId(), but works on versions of Windows before
87 // Win XP SP1 as well. 88 // Win XP SP1 as well.
88 ProcessId GetProcId(ProcessHandle process); 89 ProcessId GetProcId(ProcessHandle process);
89 90
91 #if defined(OS_LINUX)
92 // Returns the ID for the parent of the given process.
93 ProcessId GetParentProcessId(ProcessHandle process);
94
95 // Returns the path to the executable of the given process.
96 FilePath GetProcessExecutablePath(ProcessHandle process);
97 #endif
98
90 #if defined(OS_POSIX) 99 #if defined(OS_POSIX)
91 // Sets all file descriptors to close on exec except for stdin, stdout 100 // Sets all file descriptors to close on exec except for stdin, stdout
92 // and stderr. 101 // and stderr.
93 // TODO(agl): remove this function 102 // TODO(agl): remove this function
94 // WARNING: do not use. It's inherently race-prone in the face of 103 // WARNING: do not use. It's inherently race-prone in the face of
95 // multi-threading. 104 // multi-threading.
96 void SetAllFDsToCloseOnExec(); 105 void SetAllFDsToCloseOnExec();
97 // Close all file descriptors, expect those which are a destination in the 106 // Close all file descriptors, expect those which are a destination in the
98 // given multimap. Only call this function in a child process where you know 107 // given multimap. Only call this function in a child process where you know
99 // that there aren't any other threads. 108 // that there aren't any other threads.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // overflow. Has no effect if the OS doesn't provide the necessary facility. 400 // overflow. Has no effect if the OS doesn't provide the necessary facility.
392 void EnableTerminationOnHeapCorruption(); 401 void EnableTerminationOnHeapCorruption();
393 402
394 // If supported on the platform, and the user has sufficent rights, increase 403 // If supported on the platform, and the user has sufficent rights, increase
395 // the current process's scheduling priority to a high priority. 404 // the current process's scheduling priority to a high priority.
396 void RaiseProcessToHighPriority(); 405 void RaiseProcessToHighPriority();
397 406
398 } // namespace base 407 } // namespace base
399 408
400 #endif // BASE_PROCESS_UTIL_H_ 409 #endif // BASE_PROCESS_UTIL_H_
OLDNEW
« no previous file with comments | « base/logging.cc ('k') | base/process_util_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698