Re: Signalling from kernel

Mark Hemment (markhe@nextd.demon.co.uk)
Mon, 14 Apr 1997 21:13:24 +0100 (BST)


Hi,

On Mon, 14 Apr 1997, Claus Schroeter wrote:
> is there a simple way to call an user-level funktion from kernel space
> or at least let the process notify that a driver completed a task.

Not 100% sure why you would want to do this, but as far as I know there is
no safe way (at the moment). Even calling send_sig() from a drivers
interrupt routine is unhealthy.

> I think
> the IPC message approach, kerneld uses will be a good solution,
> but it seems that it is not possible to register a message interface
> with the kernel dynamically.

Correct. There is no generic kernel->user message channel (as opposed to
user->kernel->user).
Implementing such a channel would be useful. I was looking at file
watchdogs yesterday (sending a message to a register task when another
task performs some operation on a watched file, such as opening or
writing), which would also needed a kernel->user channel.
If you want to implement the channel, I'd be v. happy :), but it making it
"called from interrupt" safe would be over-kill for most uses.

> I ask because I'm trying to implement a simple signal-like behaviour for
> drivers developed with the (Linux Driver Development Kit
> http://www.llp.fu-berlin.de/pool/software/dutil/) An I'm looking
> for a fast and simple solution.

I cannot think of a fast and simple solution.
If you do not need to send messages from an interrupt, then posting a user
signal is possible.
Adding a info device node for a driver is possible. Basically, you hide
another driver along side your driver (add an extra file_operations
structure with an open, release and read routines).
When a task reads from your info-driver device node (say
/dev/mydriver-info), you copy data into the users read buffer. It's easy
to make the info-read routine block until an event occurs in your
real-driver (this is useful in debugging).

Sorry I cannot be of more help,

markhe

------------------------------------------------------------------
Mark Hemment, Unix/C Software Engineer (Contractor)
markhe@nextd.demon.co.uk http://www.nextd.demon.co.uk/
"Success has many fathers, failure is a B**TARD!" - anon
------------------------------------------------------------------