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 <vlee@freedesktop.org>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7911>
This commit is contained in:
Vinson Lee 2020-12-03 17:54:11 -08:00
parent ba42de95da
commit da16425690
1 changed files with 7 additions and 0 deletions

View File

@ -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;