Fix #4928
This commit is contained in:
parent
cdd69e951f
commit
406878ec5f
1 changed files with 5 additions and 5 deletions
|
|
@ -26,8 +26,8 @@ when defined(macosx) or defined(freebsd):
|
||||||
const MAX_DESCRIPTORS_ID = 29 # KERN_MAXFILESPERPROC (MacOS)
|
const MAX_DESCRIPTORS_ID = 29 # KERN_MAXFILESPERPROC (MacOS)
|
||||||
else:
|
else:
|
||||||
const MAX_DESCRIPTORS_ID = 27 # KERN_MAXFILESPERPROC (FreeBSD)
|
const MAX_DESCRIPTORS_ID = 27 # KERN_MAXFILESPERPROC (FreeBSD)
|
||||||
proc sysctl(name: ptr cint, namelen: cuint, oldp: pointer, oldplen: ptr int,
|
proc sysctl(name: ptr cint, namelen: cuint, oldp: pointer, oldplen: ptr csize,
|
||||||
newp: pointer, newplen: int): cint
|
newp: pointer, newplen: csize): cint
|
||||||
{.importc: "sysctl",header: """#include <sys/types.h>
|
{.importc: "sysctl",header: """#include <sys/types.h>
|
||||||
#include <sys/sysctl.h>"""}
|
#include <sys/sysctl.h>"""}
|
||||||
elif defined(netbsd) or defined(openbsd):
|
elif defined(netbsd) or defined(openbsd):
|
||||||
|
|
@ -35,8 +35,8 @@ elif defined(netbsd) or defined(openbsd):
|
||||||
# KERN_MAXFILES, because KERN_MAXFILES is always bigger,
|
# KERN_MAXFILES, because KERN_MAXFILES is always bigger,
|
||||||
# than KERN_MAXFILESPERPROC.
|
# than KERN_MAXFILESPERPROC.
|
||||||
const MAX_DESCRIPTORS_ID = 7 # KERN_MAXFILES
|
const MAX_DESCRIPTORS_ID = 7 # KERN_MAXFILES
|
||||||
proc sysctl(name: ptr cint, namelen: cuint, oldp: pointer, oldplen: ptr int,
|
proc sysctl(name: ptr cint, namelen: cuint, oldp: pointer, oldplen: ptr csize,
|
||||||
newp: pointer, newplen: int): cint
|
newp: pointer, newplen: csize): cint
|
||||||
{.importc: "sysctl",header: """#include <sys/param.h>
|
{.importc: "sysctl",header: """#include <sys/param.h>
|
||||||
#include <sys/sysctl.h>"""}
|
#include <sys/sysctl.h>"""}
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ type SelectEvent* = ptr SelectEventImpl
|
||||||
|
|
||||||
proc newSelector*[T](): Selector[T] =
|
proc newSelector*[T](): Selector[T] =
|
||||||
var maxFD = 0.cint
|
var maxFD = 0.cint
|
||||||
var size = sizeof(cint)
|
var size = csize(sizeof(cint))
|
||||||
var namearr = [1.cint, MAX_DESCRIPTORS_ID.cint]
|
var namearr = [1.cint, MAX_DESCRIPTORS_ID.cint]
|
||||||
# Obtain maximum number of file descriptors for process
|
# Obtain maximum number of file descriptors for process
|
||||||
if sysctl(addr(namearr[0]), 2, cast[pointer](addr maxFD), addr size,
|
if sysctl(addr(namearr[0]), 2, cast[pointer](addr maxFD), addr size,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue