Subject: Re: Creating and using sockets from within the kernel
To: Iain Hibbert <email@example.com>
From: None <firstname.lastname@example.org>
Date: 03/07/2006 13:28:04
In message <email@example.com>,
Iain Hibbert writes:
>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)
Ahem. For one example, see kcont(9) and my old patch which implement
splice(2) on top of kcont(9).
>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.
Creating sockets may require more thought. Creation of, or binding to,
Unix-domain sockets, for example, require a non-NULL rootvp against
which to resolve the pathname of the socket. ANd I _think_ that
rootvp is acquired via a process pointer, but I haven't looked
carefully since before scheduler activations and lwps.
All quite doable, but could be made rather cleaner with little effort.