diff options
author | Araq <rumpf_a@web.de> | 2014-10-13 08:26:24 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-10-13 08:26:24 +0200 |
commit | c7570dcd3e4202bd339a2ebbc09952a546c62269 (patch) | |
tree | 1e3b7a73a597bc825b03bce6ebac4db9a3d7d237 /lib/pure | |
parent | 5272213da4b0701890d8a42fb292962704f0b99d (diff) | |
parent | b7befd69ba0051c1db44a37c8c3e06c48990a9b1 (diff) | |
download | Nim-c7570dcd3e4202bd339a2ebbc09952a546c62269.tar.gz |
Merge branch 'devel' into bigbreak
Conflicts: compiler/ast.nim compiler/nimfix/prettybase.nim compiler/pragmas.nim compiler/sempass2.nim doc/manual.txt koch.nim lib/pure/concurrency/threadpool.nim web/news.txt
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/concurrency/cpuinfo.nim | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/pure/concurrency/cpuinfo.nim b/lib/pure/concurrency/cpuinfo.nim index e55786c3e..ac5fa5dd9 100644 --- a/lib/pure/concurrency/cpuinfo.nim +++ b/lib/pure/concurrency/cpuinfo.nim @@ -18,15 +18,24 @@ when not defined(windows): when defined(linux): import linux + +when defined(freebsd) or defined(macosx): + {.emit:"#include <sys/types.h>".} + +when defined(openbsd) or defined(netbsd): + {.emit:"#include <sys/param.h>".} when defined(macosx) or defined(bsd): + # we HAVE to emit param.h before sysctl.h so we cannot use .header here + # either. The amount of archaic bullshit in Poonix based OSes is just insane. + {.emit:"#include <sys/sysctl.h>".} const CTL_HW = 6 HW_AVAILCPU = 25 HW_NCPU = 3 proc sysctl(x: ptr array[0..3, cint], y: cint, z: pointer, a: var csize, b: pointer, c: int): cint {. - importc: "sysctl", header: "<sys/sysctl.h>".} + importc: "sysctl", nodecl.} proc countProcessors*(): int {.rtl, extern: "ncpi$1".} = ## returns the numer of the processors/cores the machine has. |