A trick that can be used to get EOL events while ignoring all READ events is to supply a ridiculously high value to NOTE_LOWAT, thus suppressing all READ events.
Here's an example doing this in a Python REPL:
Python 2.6.5 (r265:79063, Jul 17 2010, 22:57:01)
[GCC 4.2.1 20070719 [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
>>> import select
>>> import socket
>>> import sys
>>> a, b = socket.socketpair()
>>> kq = select.kqueue()
>>> kq.control([select.kevent(a, select.KQ_FILTER_READ, select.KQ_EV_ADD, select.KQ_NOTE_LOWAT, sys.maxint)], 0)
[]
>>> b.send('abc')
3
>>> kq.control(None, 10) # Interrupt after some time.
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyboardInterrupt
>>> b.close()
>>> kq.control(None, 10) # Immediate return.
[<select.kevent ident=3 filter=-1 flags=0x8000 fflags=0x0 data=0x3 udata=0x0>]
>>>
Moreover, there is no such thing as exceptional state on FreeBSD, to quote man 2 select
:
The only exceptional condition
detectable is out-of-band data
received on a socket.