I'm modifying an app in order to replace its use of select() with kqueue. select() allows one to poll for exceptional conditions:
int select(int nfds,
fd_set *restrict readfds,
fd_set *restrict writefds,
fd_set *restrict errorfds, <---- this thing here
struct timeval *restrict timeout
);
After reading the kqueue documentation it looks like there's no way to do that. There's EVFILT_READ
and EVFILT_WRITE
but nothing along the lines of EVFILT_ERROR
/EVFILT_EXCEPTIONAL
. Is it possible to poll for exceptional conditions, and if so, how?
There is no such thing as exceptional state on FreeBSD, to quote
man 2 select
:So your question boils down to “How can I detect OOB-data on a socket with kqueue”, which I, to be honest, cannot answer without doing some research.