epoll
nimony/lib/std/posix/epoll.nim
const EPOLLIN: uint32const EPOLLPRI: uint32const EPOLLOUT: uint32const EPOLLERR: uint32const EPOLLHUP: uint32const EPOLLRDNORM: uint32const EPOLLRDBAND: uint32const EPOLLWRNORM: uint32const EPOLLWRBAND: uint32const EPOLLMSG: uint32const EPOLLRDHUP: uint32const EPOLLEXCLUSIVE: uint32const EPOLLWAKEUP: uint32const EPOLLONESHOT: uint32const EPOLLET: uint32const EPOLL_CTL_ADD: int32const EPOLL_CTL_DEL: int32const EPOLL_CTL_MOD: int32type EpollData = object ptr: pointer not nil fd: int32 u32: uint32 u64: uint64
type EpollEvent = object events: uint32 data: EpollData
proc epoll_create(size: int32): int32Creates 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 returned by epoll_create() should be closed with close().
proc epoll_create1(flags: int32): int32Same as epoll_create but with an FLAGS parameter. The unused SIZE parameter has been dropped.
proc epoll_ctl(epfd: int32; op: int32; fd: FD; event: ptr EpollEvent): int32Manipulate an epoll instance "epfd". Returns
0in case of success,-1in case of error (the "errno" variable will contain the specific error code).The "op" parameter is one of the
EPOLL_CTL_*constants defined above. The "fd" parameter is the target of the operation. The "event" parameter describes which events the caller is interested in and any associated user data.proc epoll_wait(epfd: int32; events: ptr EpollEvent not nil; maxevents: int32; timeout: int32): int32Wait for events on an epoll instance "epfd". Returns the number of triggered events returned in "events" buffer. Or -1 in case of error with the "errno" variable set to the specific error code. The "events" parameter is a buffer that will contain triggered events. The "maxevents" is the maximum number of events to be returned ( usually size of "events" ). The "timeout" parameter specifies the maximum wait time in milliseconds (-1 == infinite).
This function is a cancellation point and therefore not marked with __THROW.