From 9e51e737b6216fa373662442907874d7b61db1a6 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Sun, 1 Apr 2018 20:17:32 +0800 Subject: RLIMIT_NOFILE as posix const --- lib/pure/ioselects/ioselectors_epoll.nim | 6 ++---- lib/pure/ioselects/ioselectors_poll.nim | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/pure') diff --git a/lib/pure/ioselects/ioselectors_epoll.nim b/lib/pure/ioselects/ioselectors_epoll.nim index 98b8a2b2b..65efeabab 100644 --- a/lib/pure/ioselects/ioselectors_epoll.nim +++ b/lib/pure/ioselects/ioselectors_epoll.nim @@ -48,8 +48,6 @@ when not defined(android): proc signalfd(fd: cint, mask: var Sigset, flags: cint): cint {.cdecl, importc: "signalfd", header: "".} -var RLIMIT_NOFILE {.importc: "RLIMIT_NOFILE", - header: "".}: cint type RLimit {.importc: "struct rlimit", header: "", pure, final.} = object @@ -82,7 +80,7 @@ type proc newSelector*[T](): Selector[T] = # Retrieve the maximum fd count (for current OS) via getrlimit() var a = RLimit() - if getrlimit(RLIMIT_NOFILE, a) != 0: + if getrlimit(posix.RLIMIT_NOFILE, a) != 0: raiseOsError(osLastError()) var maxFD = int(a.rlim_max) doAssert(maxFD > 0) @@ -528,4 +526,4 @@ template withData*[T](s: Selector[T], fd: SocketHandle|int, value, body1, body2 proc getFd*[T](s: Selector[T]): int = - return s.epollFd.int \ No newline at end of file + return s.epollFd.int diff --git a/lib/pure/ioselects/ioselectors_poll.nim b/lib/pure/ioselects/ioselectors_poll.nim index 66d52b352..081c57fa6 100644 --- a/lib/pure/ioselects/ioselectors_poll.nim +++ b/lib/pure/ioselects/ioselectors_poll.nim @@ -40,8 +40,6 @@ type wfd: cint SelectEvent* = ptr SelectEventImpl -var RLIMIT_NOFILE {.importc: "RLIMIT_NOFILE", - header: "".}: cint type rlimit {.importc: "struct rlimit", header: "", 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 \ No newline at end of file + return -1 -- cgit 1.4.1-2-gfad0