Ticket #45832: patch-js-src-jsgc.cpp.diff

File patch-js-src-jsgc.cpp.diff, 1.2 KB (added by ballapete (Peter "Pete" Dyballa), 9 years ago)

Patch for js/src/jsgc.cpp

  • js/src/jsgc.

    old new  
    9595
    9696#ifdef XP_WIN
    9797# include "jswin.h"
    98 #else
    99 # include <unistd.h>
     98#else   /* Handle Mac OS X < 10.5, pre-Leopard */
     99# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050 || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
     100#  include <sys/param.h>
     101#  include <sys/sysctl.h>
     102# else
     103#  include <unistd.h>   /* On Mac OS X < 10.5 no definition of _SC_NPROCESSORS_ONLN */
     104# endif
    100105#endif
    101106
    102107using namespace mozilla;
     
    28642869        SYSTEM_INFO sysinfo;
    28652870        GetSystemInfo(&sysinfo);
    28662871        ncpus = unsigned(sysinfo.dwNumberOfProcessors);
     2872# elif __MAC_OS_X_VERSION_MIN_REQUIRED < 1050 || __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
     2873        int nm[2];
     2874        size_t len = 4;
     2875
     2876        nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
     2877        sysctl(nm, 2, &ncpus, &len, NULL, 0);
     2878
     2879        if(ncpus < 1) {
     2880        nm[1] = HW_NCPU;
     2881        sysctl(nm, 2, &ncpus, &len, NULL, 0);
     2882        if(ncpus < 1) { ncpus = 1; }
     2883        }
    28672884# else
    28682885        long n = sysconf(_SC_NPROCESSORS_ONLN);
    28692886        ncpus = (n > 0) ? unsigned(n) : 1;