Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion vanitygen.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@

#include "custom_ec_bn.h"

#if defined(__APPLE__)
#include <sys/sysctl.h>
#endif

const char *version = VANITYGEN_VERSION;

const enum compressiontype{
Expand Down Expand Up @@ -425,9 +429,14 @@ vg_thread_loop(void *arg)
int
count_processors(void)
{
int count = 0;

#if defined(__APPLE__)
size_t count_len = sizeof(count);
sysctlbyname("hw.logicalcpu", &count, &count_len, NULL, 0);
#else
FILE *fp;
char buf[512];
int count = 0;

fp = fopen("/proc/cpuinfo", "r");
if (!fp)
Expand All @@ -438,6 +447,8 @@ count_processors(void)
count += 1;
}
fclose(fp);
#endif

return count;
}
#endif
Expand Down