Date: Tue, 25 May 2010 08:55:57 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Dmitry Krivenok <krivenok.dmitry@gmail.com> Subject: Re: select/poll for sockets in kernel space Message-ID: <201005250855.57770.jhb@freebsd.org> In-Reply-To: <AANLkTimTGjiEolesEOMN6Zdo-wjmuT5nFDzbHYk_-sI1@mail.gmail.com> References: <AANLkTimTGjiEolesEOMN6Zdo-wjmuT5nFDzbHYk_-sI1@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 25 May 2010 5:02:35 am Dmitry Krivenok wrote: > 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. Why do you have to use select/poll? If these are dedicated sockets that you create internally, then the right thing to do is probably to install your own upcalls that get called when data for a socket arrives. This is what the in- kernel NFS client does to handle incoming data. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005250855.57770.jhb>