Subject: Re: Creating and using sockets from within the kernel
To: Jon Taylor <firstname.lastname@example.org>
From: Iain Hibbert <email@example.com>
Date: 03/07/2006 21:15:12
On Tue, 7 Mar 2006, Jon Taylor wrote:
> I can't seem to find much info on this topic via Google. Grepping the
> kernel sources shows me socreate(), which looks like it takes a pointer
> to a process (and is thus unusable in the kernel proper). Maybe I can
> use socreate() in a kernel thread? Any help, example code or references
> will be much appreciated.
I was thinking about this yesterday, heh.
I think it is possible to use sockets from within the kernel withouth
threads, though its not especially obvious and for my work I have not done
so (though I dont think its going to be too much work to change, should
that be necessary)
You can use NULL for the process pointer, and set SS_NBIO so that it never
sleeps then make sure you never send more than it can take or try to read
more than is available. Then, if you want to receive wakeup notifications
set so_upcall/so_upcallarg fields in the socket and set SB_UPCALL in the
I think, anyway.