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

Side by Side Diff: base/sys_info_posix.cc

Issue 7184032: Upstream android file related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove android specific shmem method Created 9 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
« base/shared_memory_posix.cc ('K') | « base/shared_memory_posix.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <string.h> 8 #include <string.h>
9 #include <sys/param.h> 9 #include <sys/param.h>
10 #include <sys/statvfs.h>
11 #include <sys/sysctl.h>
12 #include <sys/utsname.h> 10 #include <sys/utsname.h>
13 #include <unistd.h> 11 #include <unistd.h>
14 12
15 #include "base/basictypes.h" 13 #include "base/basictypes.h"
16 #include "base/file_util.h" 14 #include "base/file_util.h"
17 #include "base/logging.h" 15 #include "base/logging.h"
18 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
19 17
18 #if defined(OS_ANDROID)
19 #include <sys/vfs.h>
20 #define statvfs statfs // Android uses a statvfs-like statfs struct and call.
21 #else
22 #include <sys/statvfs.h>
23 #include <sys/sysctl.h>
24 #endif
25
20 namespace base { 26 namespace base {
21 27
22 #if !defined(OS_OPENBSD) 28 #if !defined(OS_OPENBSD)
23 int SysInfo::NumberOfProcessors() { 29 int SysInfo::NumberOfProcessors() {
24 // It seems that sysconf returns the number of "logical" processors on both 30 // It seems that sysconf returns the number of "logical" processors on both
25 // Mac and Linux. So we get the number of "online logical" processors. 31 // Mac and Linux. So we get the number of "online logical" processors.
26 long res = sysconf(_SC_NPROCESSORS_ONLN); 32 long res = sysconf(_SC_NPROCESSORS_ONLN);
27 if (res == -1) { 33 if (res == -1) {
28 NOTREACHED(); 34 NOTREACHED();
29 return 1; 35 return 1;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 79 }
74 return std::string(info.machine); 80 return std::string(info.machine);
75 } 81 }
76 82
77 // static 83 // static
78 size_t SysInfo::VMAllocationGranularity() { 84 size_t SysInfo::VMAllocationGranularity() {
79 return getpagesize(); 85 return getpagesize();
80 } 86 }
81 87
82 } // namespace base 88 } // namespace base
OLDNEW
« base/shared_memory_posix.cc ('K') | « base/shared_memory_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698