# select/poll for sockets in kernel space



## krivenok (May 24, 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.


----------



## DutchDaemon (May 24, 2010)

The FreeBSD mailing lists are a much better place to ask this. That's where most of the developers are.


----------

