Mesa (main): util: fix util_cpu_detect_once() build on OpenBSD

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Feb 26 01:37:24 UTC 2022


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

Author: Jonathan Gray <jsg at jsg.id.au>
Date:   Wed Oct 20 11:58:01 2021 +1100

util: fix util_cpu_detect_once() build on OpenBSD

Correct type for sysctl argument to fix the build.

../src/util/u_cpu_detect.c:631:29: error: incompatible pointer types passing 'int *' to parameter of type 'size_t *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types]
      sysctl(mib, 2, &ncpu, &len, NULL, 0);
                            ^~~~

Fixes: 5623c75e40b ("util: Fix setting nr_cpus on some BSD variants")
Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13448>

---

 src/util/u_cpu_detect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c
index 636c186743c..87f47cda931 100644
--- a/src/util/u_cpu_detect.c
+++ b/src/util/u_cpu_detect.c
@@ -625,7 +625,7 @@ util_cpu_detect_once(void)
    if (available_cpus == 0) {
       const int mib[] = { CTL_HW, HW_NCPUONLINE };
       int ncpu;
-      int len = sizeof(ncpu);
+      size_t len = sizeof(ncpu);
 
       sysctl(mib, 2, &ncpu, &len, NULL, 0);
       available_cpus = ncpu;



More information about the mesa-commit mailing list