From 27414daadf5727e8ab942374b5ec1c8990122878 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Sat, 29 Aug 2009 13:39:21 +0300 Subject: Fix sysctl() usage. This fixes build on *BSDs and Darwin. Thanks to Jukka Salmi for the patches. Richard Koch reported the problem too. --- src/common/cpucores.h | 2 +- src/common/physmem.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/common/cpucores.h b/src/common/cpucores.h index 704d8a26..330cd9c9 100644 --- a/src/common/cpucores.h +++ b/src/common/cpucores.h @@ -40,7 +40,7 @@ cpucores(void) int name[2] = { CTL_HW, HW_NCPU }; int cpus; size_t cpus_size = sizeof(cpus); - if (!sysctl(name, &cpus, &cpus_size, NULL, NULL) + if (!sysctl(name, 2, &cpus, &cpus_size, NULL, 0) && cpus_size == sizeof(cpus) && cpus > 0) ret = (uint32_t)(cpus); #endif diff --git a/src/common/physmem.h b/src/common/physmem.h index 63482c6c..0dc77e97 100644 --- a/src/common/physmem.h +++ b/src/common/physmem.h @@ -104,7 +104,7 @@ physmem(void) uint64_t u64; } mem; size_t mem_ptr_size = sizeof(mem.u64); - if (!sysctl(name, 2, &mem.u64, &mem_ptr_size, NULL, NULL)) { + if (!sysctl(name, 2, &mem.u64, &mem_ptr_size, NULL, 0)) { // IIRC, 64-bit "return value" is possible on some 64-bit // BSD systems even with HW_PHYSMEM (instead of HW_PHYSMEM64), // so support both. -- cgit v1.2.3