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

Side by Side Diff: base/process_util_ios.mm

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/process_util_freebsd.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <sys/resource.h> 9 #include <sys/resource.h>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 12
13 // This is just enough of a shim to let the support needed by test_support 13 // This is just enough of a shim to let the support needed by test_support
14 // link. In general, process_util isn't valid on iOS. 14 // link. In general, process_util isn't valid on iOS.
15 15
16 namespace base { 16 namespace base {
17 17
18 ProcessId GetCurrentProcId() {
19 return getpid();
20 }
21
22 ProcessHandle GetCurrentProcessHandle() {
23 return GetCurrentProcId();
24 }
25
26 void RaiseProcessToHighPriority() { 18 void RaiseProcessToHighPriority() {
27 // Impossible on iOS. Do nothing. 19 // Impossible on iOS. Do nothing.
28 } 20 }
29 21
30 size_t GetMaxFds() {
31 static const rlim_t kSystemDefaultMaxFds = 256;
32 rlim_t max_fds;
33 struct rlimit nofile;
34 if (getrlimit(RLIMIT_NOFILE, &nofile)) {
35 // Error case: Take a best guess.
36 max_fds = kSystemDefaultMaxFds;
37 } else {
38 max_fds = nofile.rlim_cur;
39 }
40
41 if (max_fds > INT_MAX)
42 max_fds = INT_MAX;
43
44 return static_cast<size_t>(max_fds);
45 }
46
47 } // namespace base 22 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util_freebsd.cc ('k') | base/process_util_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698