Skip to content

Commit

Permalink
i#58 MacOS: use sysctlbyname initially for get_num_processors
Browse files Browse the repository at this point in the history
SVN-Revision: 2309
  • Loading branch information
derekbruening committed Oct 8, 2013
1 parent 455007c commit 17b1855
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/unix/os.c
Expand Up @@ -68,7 +68,7 @@
#include <limits.h>

#ifdef MACOS
# include <sys/sysctl.h> /* for sysctlbyname */
# include <sys/sysctl.h> /* for sysctlbyname */
#endif

#ifdef LINUX
Expand Down Expand Up @@ -2741,7 +2741,8 @@ get_num_processors(void)
* which should be lower-level than sysctlbyname(), and replace
* that w/ its straightforward raw syscall underneath later.
*/
num_cpu = sysctlbyname("hw.ncpu");
int res = sysctlbyname("hw.ncpu", NULL, NULL, &num_cpu, sizeof(num_cpu));
ASSERT(res == 0);
#else
/* We used to use get_nprocs_conf, but that's in libc, so now we just
* look at the /sys filesystem ourselves, which is what glibc does.
Expand Down

0 comments on commit 17b1855

Please sign in to comment.