2 #include "thread-utils.h"
5 # define WIN32_LEAN_AND_MEAN
7 #elif defined(hpux) || defined(__hpux) || defined(_hpux)
8 # include <sys/pstat.h>
12 * By doing this in two steps we can at least get
13 * the function to be somewhat coherent, even
14 * with this disgusting nest of #ifdefs.
16 #ifndef _SC_NPROCESSORS_ONLN
17 # ifdef _SC_NPROC_ONLN
18 # define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
19 # elif defined _SC_CRAY_NCPU
20 # define _SC_NPROCESSORS_ONLN _SC_CRAY_NCPU
24 int git_online_cpus(void)
26 #ifdef _SC_NPROCESSORS_ONLN
34 if ((int)info
.dwNumberOfProcessors
> 0)
35 return (int)info
.dwNumberOfProcessors
;
36 #elif defined(hpux) || defined(__hpux) || defined(_hpux)
37 struct pst_dynamic psd
;
39 if (!pstat_getdynamic(&psd
, sizeof(psd
), (size_t)1, 0))
40 return (int)psd
.psd_proc_cnt
;
43 #ifdef _SC_NPROCESSORS_ONLN
44 if ((ncpus
= (long)sysconf(_SC_NPROCESSORS_ONLN
)) > 0)