diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2014-10-11 02:05:47 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2014-10-11 02:05:47 +0200 |
commit | 8afb85b3d42b45509c78aa38a6009766cfe371f2 (patch) | |
tree | 03a0737f50668ccd236b3fe300a0b7e88be8ace3 /lib | |
parent | 1da251523fb5e09d1edcd1ff37c2c993ec26273b (diff) | |
parent | 54f6280d7659ce057a64cd9878a17c26065a7321 (diff) | |
download | Nim-8afb85b3d42b45509c78aa38a6009766cfe371f2.tar.gz |
Merge pull request #1559 from lorxu/devel
Update cpuinfo.nim to compile in bsd and macosx
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/concurrency/cpuinfo.nim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/pure/concurrency/cpuinfo.nim b/lib/pure/concurrency/cpuinfo.nim index dfa819f64..cd8e5b14a 100644 --- a/lib/pure/concurrency/cpuinfo.nim +++ b/lib/pure/concurrency/cpuinfo.nim @@ -18,15 +18,22 @@ 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): + {.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".} proc countProcessors*(): int {.rtl, extern: "ncpi$1".} = ## returns the numer of the processors/cores the machine has. |