]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/gc: correct total_ram calculation with HAVE_BSD_SYSCTL
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Mon, 7 Jul 2025 16:45:18 +0000 (09:45 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Jul 2025 17:04:32 +0000 (10:04 -0700)
commit781c1cf5712f1768278f7f926f39ebad3be4aae0
tree0925d17935ccaa3a5d7d74a99ef4885337739011
parent35c1d592cd11429e402501df3ad68bcd0fb86bef
builtin/gc: correct total_ram calculation with HAVE_BSD_SYSCTL

The calls to sysctl() assume a 64-bit memory size for the variable
holding the value, but the actual size depends on the key name and
platform, at least for HW_PHYSMEM.

Detect any mismatched reads, and retry with a shorter variable
when needed.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/gc.c