diff options
Diffstat (limited to 'contrib/gcclibs/libiberty/physmem.c')
-rw-r--r-- | contrib/gcclibs/libiberty/physmem.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/gcclibs/libiberty/physmem.c b/contrib/gcclibs/libiberty/physmem.c index 09fbf3f..3c18169 100644 --- a/contrib/gcclibs/libiberty/physmem.c +++ b/contrib/gcclibs/libiberty/physmem.c @@ -182,6 +182,36 @@ physmem_total (void) return 0; } +/* APPLE LOCAL begin retune gc params 6124839 */ +unsigned int +ncpu_available (void) +{ +#if HAVE_SYSCTL && defined HW_AVAILCPU + { /* This works on *bsd and darwin. */ + unsigned int ncpu; + size_t len = sizeof ncpu; + static int mib[2] = { CTL_HW, HW_AVAILCPU }; + + if (sysctl (mib, ARRAY_SIZE (mib), &ncpu, &len, NULL, 0) == 0 + && len == sizeof (ncpu)) + return ncpu; + } +#endif +#if HAVE_SYSCTL && defined HW_NCPU + { /* This works on *bsd and darwin. */ + unsigned int ncpu; + size_t len = sizeof ncpu; + static int mib[2] = { CTL_HW, HW_NCPU }; + + if (sysctl (mib, ARRAY_SIZE (mib), &ncpu, &len, NULL, 0) == 0 + && len == sizeof (ncpu)) + return ncpu; + } +#endif + return 1; +} +/* APPLE LOCAL end retune gc params 6124839 */ + /* Return the amount of physical memory available. */ double physmem_available (void) |