KWSys 2026-11-05 (3f6dbdae)

Code extracted from:

    https://gitlab.kitware.com/utils/kwsys.git

at commit 3f6dbdae567f1cfb6a459359825677d106db6362 (master).

Upstream Shortlog
-----------------

Aymeric Wibo (2):
      10b37500 SystemInformation: Fix reading hw.physmem on FreeBSD & DragonFly
      642ccce9 SystemInformation: Implement getting available memory on FreeBSD
This commit is contained in:
KWSys Upstream authored and Brad King committed 2026-11-05 09:27:35 -05:00
1 parent e6897de851
commit 2a94d6e33f
1 file changed
+17
+17
View File
@@ -5395,6 +5395,8 @@ bool SystemInformationImplementation::QueryBSDMemory()
# if defined(HW_PHYSMEM64)
int64_t k;
ctrl[1] = HW_PHYSMEM64;
# elif defined(__FreeBSD__) || defined(__DragonFly__)
unsigned long k;
# else
int k;
# endif
@@ -5406,6 +5408,21 @@ bool SystemInformationImplementation::QueryBSDMemory()
this->TotalPhysicalMemory = k >> 10 >> 10;
# if defined(__FreeBSD__)
u_int freeCount;
u_int pageSize;
sz = sizeof(freeCount);
if (sysctlbyname("vm.stats.vm.v_free_count", &freeCount, &sz, nullptr, 0) ==
0) {
sz = sizeof(pageSize);
if (sysctlbyname("vm.stats.vm.v_page_size", &pageSize, &sz, nullptr, 0) ==
0) {
this->AvailablePhysicalMemory =
(static_cast<uint64_t>(freeCount) * pageSize) >> 10 >> 10;
}
}
# endif
return true;
#else
return false;