I confirm this patch is correct.
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
I also used the following test program:
------------------------------------------------------------------------
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#define ARRAY_SIZE(array) (sizeof array / sizeof *array)
int
main (void)
{
{
unsigned int physmem;
size_t len = sizeof physmem;
static int mib[2] = { CTL_HW, HW_PHYSMEM };
if (!(sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0
&& len == sizeof (physmem)))
abort ();
printf ("HW_PHYSMEM: %jd\n", (intmax_t) physmem);
}
{
int64_t physmem;
size_t len = sizeof physmem;
static int mib[2] = { CTL_HW, HW_PHYSMEM64 };
if (!(sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0
&& len == sizeof (physmem)))
abort ();
printf ("HW_PHYSMEM64: %jd\n", (intmax_t) physmem);
}
return 0;
}
------------------------------------------------------------------------On NetBSD 10.0:
$ ./a.out
HW_PHYSMEM: 4294967295
HW_PHYSMEM64: 17153662976OpenBSD 7.6:
$ ./a.out
HW_PHYSMEM: 4286128128
HW_PHYSMEM64: 17171030016Thanks for the fix.
Collin