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

Unified Diff: base/sys_info_openbsd.cc

Issue 13945012: Implement missing SysInfo methods on OpenBSD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try upload again Created 7 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_openbsd.cc
diff --git a/base/sys_info_openbsd.cc b/base/sys_info_openbsd.cc
index b9aec20e74cd9cbf0b60155194f86be84fd039b1..d6e0a1e5255ca1d9b37fd399fa435a5119bf6871 100644
--- a/base/sys_info_openbsd.cc
+++ b/base/sys_info_openbsd.cc
@@ -34,6 +34,17 @@ int64 SysInfo::AmountOfPhysicalMemory() {
return static_cast<int64>(pages) * page_size;
}
+// static
+int64 SysInfo::AmountOfAvailablePhysicalMemory() {
+ long available_pages = sysconf(_SC_AVPHYS_PAGES);
Mark Mentovai 2013/04/09 20:37:08 Other than the constant used on this line, this is
Paweł Hajdan Jr. 2013/04/09 20:42:53 +1
mdempsky_google 2013/04/09 21:21:54 Done for sys_info_openbsd.cc. Let me know if you
+ long page_size = sysconf(_SC_PAGESIZE);
+ if (available_pages == -1 || page_size == -1) {
+ NOTREACHED();
+ return 0;
+ }
+ return static_cast<int64>(available_pages) * page_size;
+}
+
size_t SysInfo::MaxSharedMemorySize() {
int mib[] = { CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX };
size_t limit;
@@ -45,4 +56,14 @@ size_t SysInfo::MaxSharedMemorySize() {
return limit;
}
+// static
+std::string SysInfo::CPUModelName() {
+ int mib[] = { CTL_HW, HW_MODEL };
Mark Mentovai 2013/04/09 20:37:08 Can this be const? Same on line 49.
mdempsky_google 2013/04/09 21:21:54 Sort of. The sysctl() interface on OpenBSD (curre
+ char name[256];
+ size_t len = arraysize(name);
+ if (sysctl(mib, arraysize(mib), name, &len, NULL, 0) == 0)
+ return name;
Mark Mentovai 2013/04/09 20:37:08 Matching the function above, test for the failure
mdempsky_google 2013/04/09 21:21:54 Done.
+ return std::string();
+}
+
} // namespace base
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698