+@@ -38,6 +38,7 @@
+ #include <iconv.h>
+ #include <sys/ipc.h>
+ #include <sys/shm.h>
++#include <sys/sysctl.h>
+ #include <X11/extensions/XShm.h>
+ #include <fontconfig/fontconfig.h>
+ #include <fontconfig/fcfreetype.h>
+@@ -297,23 +298,12 @@ int BC_Resources::machine_cpus = 1;
+
+ int BC_Resources::get_machine_cpus()
+ {
+- int cpus = 1;
+- FILE *proc = fopen("/proc/cpuinfo", "r");
+- if( proc ) {
+- char string[BCTEXTLEN], *cp;
+- while(!feof(proc) && fgets(string, sizeof(string), proc) ) {
+- if( !strncasecmp(string, "processor", 9) &&
+- (cp = strchr(string, ':')) != 0 ) {
+- int n = atol(cp+1) + 1;
+- if( n > cpus ) cpus = n;
+- }
+- else if( !strncasecmp(string, "cpus detected", 13) &&
+- (cp = strchr(string, ':')) != 0 )
+- cpus = atol(cp+1);
+- }
+- fclose(proc);
+- }
+- return cpus;
++ int mib[2], ncpu;
++ size_t len = sizeof(ncpu);
++ mib[0] = CTL_HW;
++ mib[1] = HW_NCPU;
++ if( sysctl(mib, 2, &ncpu, &len, 0, 0) ) ncpu = 1;
++ return ncpu;
+ }
+
+ void BC_Resources::new_vframes(int n, VFrame *vframes[], ...)
+@@ -695,7 +685,7 @@ new_vframes(20,default_medium_7segment,