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

Unified Diff: base/process_util_posix.cc

Issue 19064002: Split ProcessHandle and its related routines into base/process/process_handle.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process_util_openbsd.cc ('k') | base/process_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_posix.cc
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index e0a9169828f975d4f4cb6fe83de0bc968c09b744..5b5121022bae21330193ab5cc57ffcbd308bb140 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -162,44 +162,6 @@ void ResetChildSignalHandlersToDefaults(void) {
} // anonymous namespace
-ProcessId GetCurrentProcId() {
- return getpid();
-}
-
-ProcessHandle GetCurrentProcessHandle() {
- return GetCurrentProcId();
-}
-
-bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle) {
- // On Posix platforms, process handles are the same as PIDs, so we
- // don't need to do anything.
- *handle = pid;
- return true;
-}
-
-bool OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle) {
- // On POSIX permissions are checked for each operation on process,
- // not when opening a "handle".
- return OpenProcessHandle(pid, handle);
-}
-
-bool OpenProcessHandleWithAccess(ProcessId pid,
- uint32 access_flags,
- ProcessHandle* handle) {
- // On POSIX permissions are checked for each operation on process,
- // not when opening a "handle".
- return OpenProcessHandle(pid, handle);
-}
-
-void CloseProcessHandle(ProcessHandle process) {
- // See OpenProcessHandle, nothing to do.
- return;
-}
-
-ProcessId GetProcId(ProcessHandle process) {
- return process;
-}
-
// A class to handle auto-closing of DIR*'s.
class ScopedDIRClose {
public:
@@ -212,42 +174,19 @@ class ScopedDIRClose {
typedef scoped_ptr_malloc<DIR, ScopedDIRClose> ScopedDIR;
#if defined(OS_LINUX)
- static const rlim_t kSystemDefaultMaxFds = 8192;
- static const char kFDDir[] = "/proc/self/fd";
+static const char kFDDir[] = "/proc/self/fd";
#elif defined(OS_MACOSX)
- static const rlim_t kSystemDefaultMaxFds = 256;
- static const char kFDDir[] = "/dev/fd";
+static const char kFDDir[] = "/dev/fd";
#elif defined(OS_SOLARIS)
- static const rlim_t kSystemDefaultMaxFds = 8192;
- static const char kFDDir[] = "/dev/fd";
+static const char kFDDir[] = "/dev/fd";
#elif defined(OS_FREEBSD)
- static const rlim_t kSystemDefaultMaxFds = 8192;
- static const char kFDDir[] = "/dev/fd";
+static const char kFDDir[] = "/dev/fd";
#elif defined(OS_OPENBSD)
- static const rlim_t kSystemDefaultMaxFds = 256;
- static const char kFDDir[] = "/dev/fd";
+static const char kFDDir[] = "/dev/fd";
#elif defined(OS_ANDROID)
- static const rlim_t kSystemDefaultMaxFds = 1024;
- static const char kFDDir[] = "/proc/self/fd";
+static const char kFDDir[] = "/proc/self/fd";
#endif
-size_t GetMaxFds() {
- rlim_t max_fds;
- struct rlimit nofile;
- if (getrlimit(RLIMIT_NOFILE, &nofile)) {
- // getrlimit failed. Take a best guess.
- max_fds = kSystemDefaultMaxFds;
- RAW_LOG(ERROR, "getrlimit(RLIMIT_NOFILE) failed");
- } else {
- max_fds = nofile.rlim_cur;
- }
-
- if (max_fds > INT_MAX)
- max_fds = INT_MAX;
-
- return static_cast<size_t>(max_fds);
-}
-
void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
// DANGER: no calls to malloc are allowed from now on:
// http://crbug.com/36678
« no previous file with comments | « base/process_util_openbsd.cc ('k') | base/process_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698