improve epoll docs (#15137)

This commit is contained in:
flywind 2020-08-01 17:30:51 +08:00 • committed by GitHub
commit a7736b6b43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,44 +45,46 @@ type
proc epoll_create*(size: cint): cint {.importc: "epoll_create", proc epoll_create*(size: cint): cint {.importc: "epoll_create",
header: "<sys/epoll.h>".} header: "<sys/epoll.h>".}
## Creates an epoll instance. Returns an fd for the new instance. ## Creates an epoll instance. Returns an fd for the new instance.
## The "size" parameter is a hint specifying the number of file ##
## descriptors to be associated with the new instance. The fd ## The "size" parameter is a hint specifying the number of file
## returned by epoll_create() should be closed with close(). ## descriptors to be associated with the new instance. The fd
## returned by epoll_create() should be closed with close().
proc epoll_create1*(flags: cint): cint {.importc: "epoll_create1", proc epoll_create1*(flags: cint): cint {.importc: "epoll_create1",
header: "<sys/epoll.h>".} header: "<sys/epoll.h>".}
## Same as epoll_create but with an FLAGS parameter. The unused SIZE ## Same as epoll_create but with an FLAGS parameter. The unused SIZE
## parameter has been dropped. ## parameter has been dropped.
proc epoll_ctl*(epfd: cint; op: cint; fd: cint | SocketHandle; event: ptr EpollEvent): cint {. proc epoll_ctl*(epfd: cint; op: cint; fd: cint | SocketHandle; event: ptr EpollEvent): cint {.
importc: "epoll_ctl", header: "<sys/epoll.h>".} importc: "epoll_ctl", header: "<sys/epoll.h>".}
## Manipulate an epoll instance "epfd". Returns 0 in case of success, ## Manipulate an epoll instance "epfd". Returns ``0`` in case of success,
## -1 in case of error ( the "errno" variable will contain the ## ``-1`` in case of error (the "errno" variable will contain the specific error code).
## specific error code ) The "op" parameter is one of the EPOLL_CTL_* ##
## constants defined above. The "fd" parameter is the target of the ## The "op" parameter is one of the ``EPOLL_CTL_*``
## operation. The "event" parameter describes which events the caller ## constants defined above. The "fd" parameter is the target of the
## is interested in and any associated user data. ## operation. The "event" parameter describes which events the caller
## is interested in and any associated user data.
proc epoll_wait*(epfd: cint; events: ptr EpollEvent; maxevents: cint; proc epoll_wait*(epfd: cint; events: ptr EpollEvent; maxevents: cint;
timeout: cint): cint {.importc: "epoll_wait", timeout: cint): cint {.importc: "epoll_wait",
header: "<sys/epoll.h>".} header: "<sys/epoll.h>".}
## Wait for events on an epoll instance "epfd". Returns the number of ## Wait for events on an epoll instance "epfd". Returns the number of
## triggered events returned in "events" buffer. Or -1 in case of ## triggered events returned in "events" buffer. Or -1 in case of
## error with the "errno" variable set to the specific error code. The ## error with the "errno" variable set to the specific error code. The
## "events" parameter is a buffer that will contain triggered ## "events" parameter is a buffer that will contain triggered
## events. The "maxevents" is the maximum number of events to be ## events. The "maxevents" is the maximum number of events to be
## returned ( usually size of "events" ). The "timeout" parameter ## returned ( usually size of "events" ). The "timeout" parameter
## specifies the maximum wait time in milliseconds (-1 == infinite). ## specifies the maximum wait time in milliseconds (-1 == infinite).
## ##
## This function is a cancellation point and therefore not marked with ## This function is a cancellation point and therefore not marked with
## __THROW. ## __THROW.
#proc epoll_pwait*(epfd: cint; events: ptr EpollEvent; maxevents: cint; #proc epoll_pwait*(epfd: cint; events: ptr EpollEvent; maxevents: cint;
# timeout: cint; ss: ptr sigset_t): cint {. # timeout: cint; ss: ptr sigset_t): cint {.
# importc: "epoll_pwait", header: "<sys/epoll.h>".} # importc: "epoll_pwait", header: "<sys/epoll.h>".}
# Same as epoll_wait, but the thread's signal mask is temporarily # Same as epoll_wait, but the thread's signal mask is temporarily
# and atomically replaced with the one provided as parameter. # and atomically replaced with the one provided as parameter.
# #
# This function is a cancellation point and therefore not marked with # This function is a cancellation point and therefore not marked with
# __THROW. # __THROW.