mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
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:
1 parent
e6897de851
commit
2a94d6e33f
1 file changed
+17
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user