Re: Interface for communicating from kernel to user mode

Thor Lancelot Simon <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Message-ID <[email protected]>
On Wed, Mar 05, 2025 at 01:53:22PM +0100, Peter Skvarka wrote:
> Thank you, I have this commit on my machine and investigating it.
> 
> Described AF_LOCAL sockets are for me candidate no.1.
> I am also considering using signal (siginfo.h and signalvar.h) for sending
> signal from kernel to user process with small data.
> But like I described I need bidirectional communications,
> does provide signal interface in siginfo.h and signalvar.h also sending
> signal from user space to kernel module ?
> Or what do you thing about this idea at all ?

In the past, I have used a cloning device node, and ioctl, for this.  You
can define and implement arbitrary message-passing interfaces in that way.

And you can either have the ioctl block waiting for kernel response, or
you can implement select/poll/kevent.

The other super quick way to do this, though it's a little hacky, is with
our dynamic sysctl(3)/sysctl(9) framework.  However, in that case, you
will have to poll for changes originated on the kernel side.

-- 
Thor Lancelot Simon	                                     [email protected]
  "The liberties...lose much of their value whenever those who have greater
   private means are permitted to use their advantages to control the course
   of public debate."					-John Rawls
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.