diff options
author | Jacek Sieka <arnetheduck@gmail.com> | 2018-04-01 20:17:32 +0800 |
---|---|---|
committer | Jacek Sieka <arnetheduck@gmail.com> | 2018-04-01 20:17:32 +0800 |
commit | 9e51e737b6216fa373662442907874d7b61db1a6 (patch) | |
tree | 9eb94c1fd4b34ceed92128bb530fdaabfd718acd /lib/pure | |
parent | 86c65db18d83c77374a4b3fe31060172dc40d4cd (diff) | |
download | Nim-9e51e737b6216fa373662442907874d7b61db1a6.tar.gz |
RLIMIT_NOFILE as posix const
Diffstat (limited to 'lib/pure')
-rw-r--r-- | lib/pure/ioselects/ioselectors_epoll.nim | 6 | ||||
-rw-r--r-- | lib/pure/ioselects/ioselectors_poll.nim | 6 |
2 files changed, 4 insertions, 8 deletions
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: "<sys/signalfd.h>".} -var RLIMIT_NOFILE {.importc: "RLIMIT_NOFILE", - header: "<sys/resource.h>".}: cint type RLimit {.importc: "struct rlimit", header: "<sys/resource.h>", 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: "<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 \ No newline at end of file + return -1 |