[Gc] gc6.5 patch for FreeBSD/IRIX

Dan Bonachea bonachea at cs.berkeley.edu
Mon May 23 00:42:38 PDT 2005


The small patch to gc 6.5 included below fixes the physical CPU count 
detection for IRIX and FreeBSD in GC_thr_init().

diff -r -Naur gc6.5-orig/pthread_support.c gc6.5-new/pthread_support.c
--- gc6.5-orig/pthread_support.c        Fri May 20 17:02:07 2005
+++ gc6.5-new/pthread_support.c Mon May 23 00:41:57 2005
@@ -116,7 +116,7 @@
  # include <semaphore.h>
  #endif /* !GC_DARWIN_THREADS */

-#if defined(GC_DARWIN_THREADS)
+#if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS)
  # include <sys/sysctl.h>
  #endif /* GC_DARWIN_THREADS */

@@ -877,11 +877,11 @@
           GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
           if (GC_nprocs <= 0) GC_nprocs = 1;
  #      endif
-#       if defined(GC_FREEBSD_THREADS) || defined(GC_IRIX_THREADS)
-         /* FIXME: For Irix, that's a ridiculous assumption.   */
-          GC_nprocs = 1;
+#       if defined(GC_IRIX_THREADS)
+         GC_nprocs = sysconf(_SC_NPROC_ONLN);
+         if (GC_nprocs <= 0) GC_nprocs = 1;
  #       endif
-#       if defined(GC_DARWIN_THREADS)
+#       if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS)
           int ncpus = 1;
           size_t len = sizeof(ncpus);
           sysctl((int[2]) {CTL_HW, HW_NCPU}, 2, &ncpus, &len, NULL, 0);



More information about the Gc mailing list