summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorLuis Ricardo <luis@lorxu.com>2014-10-07 17:02:50 -0400
committerLuis Ricardo <luis@lorxu.com>2014-10-07 17:02:50 -0400
commit54f6280d7659ce057a64cd9878a17c26065a7321 (patch)
tree03a0737f50668ccd236b3fe300a0b7e88be8ace3 /lib/pure
parent1da251523fb5e09d1edcd1ff37c2c993ec26273b (diff)
downloadNim-54f6280d7659ce057a64cd9878a17c26065a7321.tar.gz
Update cpuinfo.nim
sys/types.h needed for macosx and freebsd
sys/param.h needed for openbsd and netbsd
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/concurrency/cpuinfo.nim9
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.