Search code examples
selecterror-handlingkqueue

Is there a kqueue()/kevent() equivalent to select()'s "errorfds" set?


I was porting some code from select() to kqueue() today, and I noticed that kevent() doesn't seem to have an analog for select()'s "exception-set" feature.

That is to say, select()'s function-signature is:

int select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict errorfds, struct timeval *restrict timeout);

... and with kevent(), EVFILT_READ corresponds to (readfds), and EVFILT_WRITE corresponds to (writefds), but I don't see anything like EVFILT_ERROR that would correspond to (errorfds).

Is there really just no support for socket-error-conditions under kevent(), or is it there but implemented in some way that isn't obvious to me?


Solution

  • It's not possible to filter in that way. You must manually classify incoming events based on flags (EV_EOF) and fflags.