fix(foundation): use HW_PHYSMEM for physical memory detection on FreeBSD#1093
fix(foundation): use HW_PHYSMEM for physical memory detection on FreeBSD#1093PR9000 wants to merge 1 commit into
Conversation
Signed-off-by: Pedro Ramos <131530838+pr9000@users.noreply.github.com>
|
Thanks for the focused FreeBSD fix and the on-platform validation. FreeBSD's current sys/sysctl.h defines HW_PHYSMEM for this MIB and not HW_PHYSMEM64, so the direction is correct. I have triaged this as a high-priority 0.9.1-rc stability bug. The one-line diff adds no dependency, network, secret, or broader runtime surface. The remaining blocker is the repository's reproduce-first requirement: the PR currently has no automated guard that fails on main. Because the normal matrix has no FreeBSD runner, please add the smallest testable regression or propose a narrow test seam for the MIB-selection contract before changing CI. Do not add a new workflow or dependency without design approval. The unrelated Perl/ASan duplicate-symbol problem should stay outside this PR. |
What does this PR do?
This PR fixes physical memory detection on FreeBSD by using the standard
HW_PHYSMEMsysctl indetect_system_bsd().On FreeBSD 15.1-STABLE, the current implementation using
HW_PHYSMEM64does not return the expected physical memory size during system initialization. This change routes FreeBSD through the existingHW_PHYSMEMcode path already used by OpenBSD.Changes
src/foundation/system_info.c.to:
so FreeBSD uses
HW_PHYSMEMfor physical memory detection.Testing
Tested on FreeBSD 15.1-STABLE (amd64).
Validation performed:
codebase-memory-mcpusing:Result:
The test suite was also executed:
gmake -f Makefile.cbm testHowever, the test build currently fails during linking with an unrelated AddressSanitizer duplicate symbol error:
This failure is independent from this change and occurs in the test infrastructure/linking stage before the tests are executed.
Why this is safe
This is a small, localized, platform-specific change affecting only the FreeBSD BSD implementation path.
Linux, macOS, Windows, and other supported platforms are unaffected. The change reuses the existing
HW_PHYSMEMimplementation already used for OpenBSD and does not modify the behavior of other operating systems.Checklist
git commit -s) — required, CI rejects unsigned commits ([DCO](../DCO), see [CONTRIBUTING.md](../CONTRIBUTING.md))make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)