summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorEmery Hemingway <ehmry@posteo.net>2018-08-16 18:12:37 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-08-16 18:12:37 +0200
commit2da0341b4d6828479c5dc75a233b47732f53cf6c (patch)
tree525b358312f727da17dc631e0e2090041c46f8eb /lib/pure
parent87b2d2aad6a19ae0e2cafb7fcc8ac1502aed01fa (diff)
downloadNim-2da0341b4d6828479c5dc75a233b47732f53cf6c.tar.gz
Genode fixes (#8501)
* Genode fixes

- wrap strings in "Genode::Cstring" when logging
- define SIGABRT for Genode
- disable GCC -fstack-protector
- use log RPC for fatal messages
- add --os:genode build to appveyor
- define paramStr and paramCount

* Select fixups for Genode POSIX
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/ioselects/ioselectors_select.nim6
-rw-r--r--lib/pure/os.nim10
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/pure/ioselects/ioselectors_select.nim b/lib/pure/ioselects/ioselectors_select.nim
index cd6a72b44..521b31a64 100644
--- a/lib/pure/ioselects/ioselectors_select.nim
+++ b/lib/pure/ioselects/ioselectors_select.nim
@@ -310,7 +310,10 @@ proc selectInto*[T](s: Selector[T], timeout: int,
   var rset, wset, eset: FdSet
 
   if timeout != -1:
-    tv.tv_sec = timeout.int32 div 1_000
+    when defined(genode):
+      tv.tv_sec = Time(timeout div 1_000)
+    else:
+      tv.tv_sec = timeout.int32 div 1_000
     tv.tv_usec = (timeout.int32 %% 1_000) * 1_000
   else:
     ptv = nil
@@ -391,7 +394,6 @@ proc contains*[T](s: Selector[T], fd: SocketHandle|int): bool {.inline.} =
     for i in 0..<FD_SETSIZE:
       if s.fds[i].ident == fdi:
         return true
-      inc(i)
 
 when hasThreadSupport:
   template withSelectLock[T](s: Selector[T], body: untyped) =
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index c05e33e31..8fbc20bb5 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -1363,9 +1363,15 @@ elif defined(nintendoswitch):
   proc paramCount*(): int {.tags: [ReadIOEffect].} =
     raise newException(OSError, "paramCount is not implemented on Nintendo Switch")
 
+elif defined(genode):
+  proc paramStr*(i: int): TaintedString =
+    raise newException(OSError, "paramStr is not implemented on Genode")
+
+  proc paramCount*(): int =
+    raise newException(OSError, "paramCount is not implemented on Genode")
+
 elif not defined(createNimRtl) and
-  not(defined(posix) and appType == "lib") and
-  not defined(genode):
+  not(defined(posix) and appType == "lib"):
   # On Posix, there is no portable way to get the command line from a DLL.
   var
     cmdCount {.importc: "cmdCount".}: cint