Chromium Code Reviews| 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 |