Mesa (master): util: Add os_get_page_size support for macOS.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 4 04:07:31 UTC 2020


Module: Mesa
Branch: master
Commit: da1642569071144a4f2d80b76cb4d725aa94621a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=da1642569071144a4f2d80b76cb4d725aa94621a

Author: Vinson Lee <vlee at freedesktop.org>
Date:   Thu Dec  3 17:54:11 2020 -0800

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 at freedesktop.org>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7911>

---

 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;



More information about the mesa-commit mailing list