]> Savannah Git Hosting - gnulib.git/commitdiff
nproc: port better to macOS 10.14
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 16 Oct 2021 02:33:46 +0000 (19:33 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 16 Oct 2021 02:34:19 +0000 (19:34 -0700)
* lib/nproc.c (num_processors_ignoring_omp)
[HAVE_SYSCTL && !defined __GLIBC__ && defined HW_NCPU]:
Do not use a const mib, as macOS 10.14 rejects this.

ChangeLog
lib/nproc.c

index ea71de0b20c76ce134905dc8cba102449efae233..87fd99f6a46261d051c29c03457dc50ade6a8e2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-10-15  Paul Eggert  <eggert@cs.ucla.edu>
+
+       nproc: port better to macOS 10.14
+       * lib/nproc.c (num_processors_ignoring_omp)
+       [HAVE_SYSCTL && !defined __GLIBC__ && defined HW_NCPU]:
+       Do not use a const mib, as macOS 10.14 rejects this.
+
 2021-10-13  Paul Eggert  <eggert@cs.ucla.edu>
 
        sigsegv: fix quoting problem
index a9e369dd3f7e872249412a47396ae812fde7dc24..1af989d6dd05cc021dc7f451040b3d46664dc0ea 100644 (file)
@@ -307,10 +307,11 @@ num_processors_ignoring_omp (enum nproc_query query)
      NPROC_CURRENT and NPROC_ALL.  */
 
 #if HAVE_SYSCTL && ! defined __GLIBC__ && defined HW_NCPU
-  { /* This works on Mac OS X, FreeBSD, NetBSD, OpenBSD.  */
+  { /* This works on macOS, FreeBSD, NetBSD, OpenBSD.
+       macOS 10.14 does not allow mib to be const.  */
     int nprocs;
     size_t len = sizeof (nprocs);
-    static int const mib[][2] = {
+    static int mib[][2] = {
 # ifdef HW_NCPUONLINE
       { CTL_HW, HW_NCPUONLINE },
 # endif