select/poll for sockets in kernel space

Dmitry Krivenok krivenok.dmitry at gmail.com
Tue May 25 09:02:37 UTC 2010


Hello Hackers!

I'm developing a module for FreeBSD-8 and encountered the problem with
polling sockets.
I know that FreeBSD-8 kernel provides 3 interfaces for polling
(kern/sys_generic.c):
1) kern_select
2) poll
3) selsocket

I cannot use first two interfaces because I have an array of sockets
(struct socket) created using socreate, i.e. I don't have file
descriptors.
I also cannot use selsocket because it doesn't tell me which events
fired and takes only one socket (but I have an array of sockets).

The problem is that the module I'm developing should work on
unmodified FreeBSD-8 kernel.
So I cannot just add new functionality suitable for my task in
kern/sys_generic.c.
I also cannot implement such functionality in the module itself
because select/poll implementation is hidden and only limited number
of interfaces is available to the rest
of the kernel (which is generally good, but not in my case :)).

Is it possible to solve my problem using existing kernel functionality?
Any suggestions are welcome!

Thanks in advance!

P.S.
I know about kqueue, but I have to use select/poll is this task.

-- 
Sincerely yours, Dmitry V. Krivenok
e-mail: krivenok.dmitry at gmail.com
skype: krivenok_dmitry
jabber: krivenok_dmitry at jabber.ru
icq: 242-526-443


More information about the freebsd-hackers mailing list