From da1642569071144a4f2d80b76cb4d725aa94621a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 3 Dec 2020 17:54:11 -0800 Subject: [PATCH] util: Add os_get_page_size support for macOS. Fix build error on macOS. src/util/os_misc.c:352:2: error: unexpected platform in os_sysinfo.c error unexpected platform in os_sysinfo.c ^ Fixes: ("cdf3a6a83b50 util: Add os_get_page_size query") Signed-off-by: Vinson Lee Reviewed-by: Jesse Natalie Part-of: --- src/util/os_misc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/os_misc.c b/src/util/os_misc.c index a2646bea8c4..2bac1bc2f8b 100644 --- a/src/util/os_misc.c +++ b/src/util/os_misc.c @@ -348,6 +348,13 @@ os_get_page_size(uint64_t *size) GetSystemInfo(&SysInfo); *size = SysInfo.dwPageSize; return true; +#elif DETECT_OS_APPLE + size_t len = sizeof(*size); + int mib[2]; + + mib[0] = CTL_HW; + mib[1] = HW_PAGESIZE; + return (sysctl(mib, 2, size, &len, NULL, 0) == 0); #else #error unexpected platform in os_sysinfo.c return false;