RLIMIT_NOFILE as posix const

This commit is contained in:
Jacek Sieka 2018-04-01 20:17:32 +08:00
commit 9e51e737b6
5 changed files with 13 additions and 8 deletions

View file

@ -40,8 +40,6 @@ type
wfd: cint
SelectEvent* = ptr SelectEventImpl
var RLIMIT_NOFILE {.importc: "RLIMIT_NOFILE",
header: "<sys/resource.h>".}: cint
type
rlimit {.importc: "struct rlimit",
header: "<sys/resource.h>", pure, final.} = object
@ -64,7 +62,7 @@ else:
proc newSelector*[T](): Selector[T] =
var a = rlimit()
if getrlimit(RLIMIT_NOFILE, a) != 0:
if getrlimit(posix.RLIMIT_NOFILE, a) != 0:
raiseIOSelectorsError(osLastError())
var maxFD = int(a.rlim_max)
@ -317,4 +315,4 @@ template withData*[T](s: Selector[T], fd: SocketHandle|int, value, body1,
proc getFd*[T](s: Selector[T]): int =
return -1
return -1