[MacPorts] #52822: gstreamer1 - add replacement for sysconf(_SC_NPROCESSORS_ONLN) on Tiger
MacPorts
noreply at macports.org
Sat Nov 5 19:20:33 CET 2016
#52822: gstreamer1 - add replacement for sysconf(_SC_NPROCESSORS_ONLN) on Tiger
------------------------------------+----------------------
Reporter: ken-cunningham-webuse | Owner: dbevans
Type: enhancement | Status: accepted
Priority: Normal | Milestone:
Component: ports | Version: 2.3.4
Resolution: | Keywords:
Port: gstreamer1 |
------------------------------------+----------------------
Comment (by ken-cunningham-webuse):
to make life easier:
{{{
$ cat testnumproc.c
#include <unistd.h>
#include <stdio.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/sysctl.h>
int main() {
int nm[2];
size_t len = 4;
uint32_t count;
uint32_t num_cpus;
nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
sysctl(nm, 2, &count, &len, NULL, 0);
if (count < 1) {
nm[1] = HW_NCPU;
sysctl(nm, 2, &count, &len, NULL, 0);
if (count < 1) { count = 1; }
}
num_cpus = count;
printf("number of cpus %d \n\n", count);
}
$ which gcc
/opt/local/bin/gcc
$ gcc --version
powerpc-apple-darwin8-gcc-apple-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666)
(dot 3) (MacPorts apple-gcc42 5666.3_15)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
$ gcc -o testnumpro testnumproc.c
$ ./testnumproc
number of cpus 2
}}}
--
Ticket URL: <https://trac.macports.org/ticket/52822#comment:5>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list