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

Side by Side Diff: base/sys_info_posix.cc

Issue 7065041: Fix OperatingSystemName and OperatingSystemVersion on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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/sys_info_mac.cc ('k') | content/browser/gpu/gpu_blacklist.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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> 10 #include <sys/statvfs.h>
(...skipping 28 matching lines...) Expand all
39 39
40 // static 40 // static
41 int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) { 41 int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) {
42 struct statvfs stats; 42 struct statvfs stats;
43 if (statvfs(path.value().c_str(), &stats) != 0) { 43 if (statvfs(path.value().c_str(), &stats) != 0) {
44 return -1; 44 return -1;
45 } 45 }
46 return static_cast<int64>(stats.f_bavail) * stats.f_frsize; 46 return static_cast<int64>(stats.f_bavail) * stats.f_frsize;
47 } 47 }
48 48
49 #if !defined(OS_MACOSX)
49 // static 50 // static
50 std::string SysInfo::OperatingSystemName() { 51 std::string SysInfo::OperatingSystemName() {
51 utsname info; 52 utsname info;
52 if (uname(&info) < 0) { 53 if (uname(&info) < 0) {
53 NOTREACHED(); 54 NOTREACHED();
54 return ""; 55 return "";
55 } 56 }
56 return std::string(info.sysname); 57 return std::string(info.sysname);
57 } 58 }
58 59
59 // static 60 // static
60 std::string SysInfo::OperatingSystemVersion() { 61 std::string SysInfo::OperatingSystemVersion() {
61 utsname info; 62 utsname info;
62 if (uname(&info) < 0) { 63 if (uname(&info) < 0) {
63 NOTREACHED(); 64 NOTREACHED();
64 return ""; 65 return "";
65 } 66 }
66 return std::string(info.release); 67 return std::string(info.release);
67 } 68 }
69 #endif
68 70
69 // static 71 // static
70 std::string SysInfo::CPUArchitecture() { 72 std::string SysInfo::CPUArchitecture() {
71 utsname info; 73 utsname info;
72 if (uname(&info) < 0) { 74 if (uname(&info) < 0) {
73 NOTREACHED(); 75 NOTREACHED();
74 return ""; 76 return "";
75 } 77 }
76 return std::string(info.machine); 78 return std::string(info.machine);
77 } 79 }
(...skipping 21 matching lines...) Expand all
99 return gdk_screen_get_n_monitors(screen); 101 return gdk_screen_get_n_monitors(screen);
100 } 102 }
101 #endif 103 #endif
102 104
103 // static 105 // static
104 size_t SysInfo::VMAllocationGranularity() { 106 size_t SysInfo::VMAllocationGranularity() {
105 return getpagesize(); 107 return getpagesize();
106 } 108 }
107 109
108 } // namespace base 110 } // namespace base
OLDNEW
« no previous file with comments | « base/sys_info_mac.cc ('k') | content/browser/gpu/gpu_blacklist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698