csize => csize_t for sysctl
This commit is contained in:
parent
2e20f5648b
commit
2ecef8f779
3 changed files with 10 additions and 11 deletions
|
|
@ -29,7 +29,7 @@ when defined(macosx) or defined(bsd):
|
|||
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 {.
|
||||
a: var csize_t, b: pointer, c: csize_t): cint {.
|
||||
importc: "sysctl", nodecl.}
|
||||
|
||||
when defined(genode):
|
||||
|
|
@ -73,10 +73,9 @@ proc countProcessors*(): int {.rtl, extern: "ncpi$1".} =
|
|||
var
|
||||
mib: array[0..3, cint]
|
||||
numCPU: int
|
||||
len: csize
|
||||
mib[0] = CTL_HW
|
||||
mib[1] = HW_AVAILCPU
|
||||
len = sizeof(numCPU)
|
||||
var len = sizeof(numCPU).csize_t
|
||||
discard sysctl(addr(mib), 2, addr(numCPU), len, nil, 0)
|
||||
if numCPU < 1:
|
||||
mib[1] = HW_NCPU
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue