diff options
Diffstat (limited to 'www/iridium/files/patch-base_system_sys__info__freebsd.cc')
| -rw-r--r-- | www/iridium/files/patch-base_system_sys__info__freebsd.cc | 33 | 
1 files changed, 12 insertions, 21 deletions
| diff --git a/www/iridium/files/patch-base_system_sys__info__freebsd.cc b/www/iridium/files/patch-base_system_sys__info__freebsd.cc index c5aec5efde0d..483ff4e74500 100644 --- a/www/iridium/files/patch-base_system_sys__info__freebsd.cc +++ b/www/iridium/files/patch-base_system_sys__info__freebsd.cc @@ -1,6 +1,6 @@ ---- base/system/sys_info_freebsd.cc.orig	2025-05-07 06:48:23 UTC +--- base/system/sys_info_freebsd.cc.orig	2025-10-28 14:29:43 UTC  +++ base/system/sys_info_freebsd.cc -@@ -9,28 +9,103 @@ +@@ -9,28 +9,95 @@   #include <sys/sysctl.h>   #include "base/notreached.h" @@ -9,8 +9,6 @@   namespace base { --int64_t SysInfo::AmountOfPhysicalMemoryImpl() { --  int pages, page_size;  +int SysInfo::NumberOfProcessors() {  +  int mib[] = {CTL_HW, HW_NCPU};  +  int ncpu; @@ -21,8 +19,9 @@  +  }  +  return ncpu;  +} -+   -+uint64_t SysInfo::AmountOfPhysicalMemoryImpl() { ++ + ByteCount SysInfo::AmountOfPhysicalMemoryImpl() { +-  int pages, page_size;  +  int pages, page_size, r = 0;     size_t size = sizeof(pages);  -  sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0); @@ -31,23 +30,23 @@  +  +  if (r == 0)  +    r = sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0); -+  if (r == 0)    ++  if (r == 0)  +    r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);  +  +  if (r == -1) {       NOTREACHED();     } --  return static_cast<int64_t>(pages) * page_size; +-  return ByteCount(page_size) * pages;  + -+  return static_cast<uint64_t>(pages) * page_size; ++  return ByteCount::FromUnsigned(static_cast<uint64_t>(pages) * page_size);   } -+uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() { ++ByteCount SysInfo::AmountOfAvailablePhysicalMemoryImpl() {  +  int page_size, r = 0;  +  unsigned int pgfree, pginact, pgcache;  +  size_t size = sizeof(page_size);  +  size_t szpg = sizeof(pgfree); -+  ++  +  if (r == 0)  +    r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);  +  if (r == 0) @@ -59,21 +58,13 @@  +  +  if (r == -1) {  +    NOTREACHED(); -+    return 0; ++    return ByteCount();  +  }  + -+  return static_cast<uint64_t>((pgfree + pginact + pgcache) * page_size); ++  return ByteCount::FromUnsigned(static_cast<uint64_t>((pgfree + pginact + pgcache) * page_size));  +}  +   // static -+uint64_t SysInfo::AmountOfAvailablePhysicalMemory(const SystemMemoryInfoKB& info) { -+  uint64_t res_kb = info.available != 0 -+                       ? info.available - info.active_file -+                       : info.free + info.reclaimable + info.inactive_file; -+  return res_kb * 1024; -+} -+ -+// static  +std::string SysInfo::CPUModelName() {  +  int mib[] = { CTL_HW, HW_MODEL };  +  char name[256]; | 
