Fixes to support Dragonfly BSD. (#5552)

* Fix kqueue.nim and ansi_c.nim to support dragonfly.
* Fix ioselectors.nim, threads.nim to support dragonfly.
* Fix deprecated dealloc call in tioselectors.nim.
* Fix tfsmonitor.nim test to run only on Linux.
* Fix osproc.nim return wrong exit codes.
* Fix getAppFilename() for dragonfly.
* Fix proper exit code handling.
This commit is contained in:
Eugene Kabanov 2017-03-17 09:22:11 +02:00 • committed by Andreas Rumpf
commit 336a7c9b3f
9 changed files with 39 additions and 20 deletions

View file

@ -38,7 +38,8 @@ when defined(windows):
SIGSEGV = cint(11)
SIGTERM = cint(15)
elif defined(macosx) or defined(linux) or defined(freebsd) or
defined(openbsd) or defined(netbsd) or defined(solaris):
defined(openbsd) or defined(netbsd) or defined(solaris) or
defined(dragonfly):
const
SIGABRT = cint(6)
SIGFPE = cint(8)

View file

@ -204,7 +204,12 @@ else:
proc getThreadId*(): int =
## get the ID of the currently running thread.
result = int(syscall(NR_gettid))
elif defined(macosx) or defined(bsd):
elif defined(dragonfly):
proc lwp_gettid(): int32 {.importc, header: "unistd.h".}
proc getThreadId*(): int =
result = int(lwp_gettid())
elif defined(macosx) or defined(freebsd) or defined(openbsd) or defined(netbsd):
proc pthread_threadid_np(y: pointer; x: var uint64): cint {.importc, header: "pthread.h".}
proc getThreadId*(): int =
@ -221,7 +226,6 @@ else:
## get the ID of the currently running thread.
result = int(thr_self())
const
emulatedThreadVars = compileOption("tlsEmulation")