Re: Calling userspace function from inside kernel (still) possible?

Brian Gerst (bgerst@quark.vpplus.com)
Tue, 23 Feb 1999 12:09:27 -0500


Arjan Opmeer wrote:
> I am wondering whether it is possible to call a userspace routine from
> within the kernel, say a module or something.
> The Linux Kernel Hacker Guide states as one solution to call kerneld from
> kernel mode and have it execute a seperate program.
> Since kerneld had been replaced with kmod, and the kmod documentation
> states it can only be used to load modules on demand this solution clearly
> is not an option anymore.
>
> ( Little background info: I am thinking about an extension to the kernel via
> a kernel module. Userspace processes can register themselves with that
> module and be called whenever some condition in the kernel is met. When
> someone has another idea about how to handle this situation I would
> certainly like to hear it. )

The closest thing to what you are looking for is a callback to a signal
handler. Currently there are no other kernel->user callbacks for an
already running process. Kerneld used SysV IPC, but it was a gross hack
so that's not really an option. You could try to have the kernel raise
a signal to the process (say SIGUSR1), and that signal handler would
handle the event. Or, you could have your module register a character
device and let the processes poll the device node for events.

-- 

Brian Gerst

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/