Index: base/sys_info_posix.cc |
=================================================================== |
--- base/sys_info_posix.cc (revision 2544) |
+++ base/sys_info_posix.cc (working copy) |
@@ -8,6 +8,7 @@ |
#include <errno.h> |
#include <string.h> |
#include <sys/statvfs.h> |
+#include <sys/utsname.h> |
#include <unistd.h> |
#if defined(OS_MACOSX) |
@@ -70,4 +71,60 @@ |
return static_cast<int64>(stats.f_bavail) * stats.f_frsize; |
} |
+// static |
+bool SysInfo::HasEnvironmentVariable(const char* var) { |
+ return getenv(var) != NULL; |
+} |
+ |
+// static |
+std::wstring SysInfo::GetEnvironmentVariable(const char* var) { |
+ char* value = getenv(var); |
+ if (!value) { |
+ return L""; |
+ } else { |
+ return UTF8ToWide(value); |
+ } |
+} |
+ |
+// static |
+std::string SysInfo::OperatingSystemName() { |
+ utsname info; |
+ if (uname(&info) < 0) { |
+ NOTREACHED(); |
+ return ""; |
+ } |
+ return std::string(info.sysname); |
+} |
+ |
+// static |
+std::string SysInfo::OperatingSystemVersion() { |
+ utsname info; |
+ if (uname(&info) < 0) { |
+ NOTREACHED(); |
+ return ""; |
+ } |
+ return std::string(info.release); |
+} |
+ |
+// static |
+std::string SysInfo::CPUArchitecture() { |
+ utsname info; |
+ if (uname(&info) < 0) { |
+ NOTREACHED(); |
+ return ""; |
+ } |
+ return std::string(info.machine); |
+} |
+ |
+// static |
+void SysInfo::GetPrimaryDisplayDimensions(int* width, int* height) { |
+ NOTIMPLEMENTED(); |
+} |
+ |
+// static |
+int SysInfo::DisplayCount() { |
+ NOTIMPLEMENTED(); |
+ return 1; |
+} |
+ |
} // namespace base |