Merge pull request #7873 from ehmry/GenodeEnv
Native access to Genode environment
This commit is contained in:
commit
e00e7fec54
11 changed files with 111 additions and 37 deletions
|
|
@ -38,8 +38,10 @@ when defined(macosx) or defined(bsd):
|
|||
importc: "sysctl", nodecl.}
|
||||
|
||||
when defined(genode):
|
||||
proc affinitySpaceTotal(): cuint {.
|
||||
importcpp: "genodeEnv->cpu().affinity_space().total()".}
|
||||
include genode/env
|
||||
|
||||
proc affinitySpaceTotal(env: GenodeEnvPtr): cuint {.
|
||||
importcpp: "@->cpu().affinity_space().total()".}
|
||||
|
||||
proc countProcessors*(): int {.rtl, extern: "ncpi$1".} =
|
||||
## returns the numer of the processors/cores the machine has.
|
||||
|
|
@ -83,7 +85,7 @@ proc countProcessors*(): int {.rtl, extern: "ncpi$1".} =
|
|||
var SC_NPROC_ONLN {.importc: "_SC_NPROC_ONLN", header: "<unistd.h>".}: cint
|
||||
result = sysconf(SC_NPROC_ONLN)
|
||||
elif defined(genode):
|
||||
result = affinitySpaceTotal().int
|
||||
result = runtimeEnv.affinitySpaceTotal().int
|
||||
else:
|
||||
result = sysconf(SC_NPROCESSORS_ONLN)
|
||||
if result <= 0: result = 0
|
||||
|
|
|
|||
|
|
@ -1440,7 +1440,7 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect].} =
|
|||
elif defined(solaris):
|
||||
result = getApplAux("/proc/" & $getpid() & "/path/a.out")
|
||||
elif defined(genode):
|
||||
raiseOSError("POSIX command line not supported")
|
||||
raiseOSError(OSErrorCode(-1), "POSIX command line not supported")
|
||||
elif defined(freebsd) or defined(dragonfly):
|
||||
result = getApplFreebsd()
|
||||
# little heuristic that may work on other POSIX-like systems:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue