Sending signals from the kernel to user space

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

I am working on a Linux embedded project at the moment with one simple
small requirement : when a certain event occurs within a kernel driver,
I need to locate a listening user-space process and signal it somehow.

(1) How can I locate the PID of the specific process I want to handle
this ? Can I query for the PID by name ?

(2) Once I have the PID, is it simply a matter of using sys_signal() to
send the signal to the process ?

Thanks in advance for any help possible.

--

"Jokes mentioning ducks were considered particularly funny." - cnn.com


Re: Sending signals from the kernel to user space
Quoted text here. Click to load it

I assume you are writing or at least customising the driver?  If so, you
could add an IOCTL call to the driver, which the user program makes to
register its PID with the driver.

Quoted text here. Click to load it

send_signal() looks better for this purpose.  Get the driver to create
and populate a siginfo and sigpending structures, and pass pointers to
send_signal.

Regards,

John


Re: Sending signals from the kernel to user space
X-No-Archive:yes

A certain John Williams, of comp.os.linux.embedded "fame", writes :

Quoted text here. Click to load it

This sounds like it's exactly the ticket. I'll check it out.

Quoted text here. Click to load it

Wonderful - exactly the kind of thing I had in mind. Thanks.

--

"Jokes mentioning ducks were considered particularly funny." - cnn.com


Re: Sending signals from the kernel to user space
Do you _really_ need to send a signal to the processor ?

The standard way to do a ready message to a user process is using normal
I/O. E.g. a blocking read to the device file done by the user process
could be freed on ready (see e.g. "rtc.c" in the standard distribution
as an example). Moreover (e.g. with a "select" statement and IOCTL) the
user program  can inform itself about the state of the device without
being blocked simply using the device file interface.

-Michael

Re: Sending signals from the kernel to user space
X-No-Archive:yes

A certain Michael Schnell, of comp.os.linux.embedded "fame", writes :

Quoted text here. Click to load it

The reason why this is a little inappropriate is because I'm supporting
a proprietary network stack, on an embedded Linux setup, which must run
in user space for a number of reasons. So I'm going to have a network
driver in the kernel which will handle and clear the actual interrupts
from the network hardware, and then signal the user space task to come
and collect the data.

--

"Jokes mentioning ducks were considered particularly funny." - cnn.com


Re: Sending signals from the kernel to user space
Quoted text here. Click to load it

Look again!  The normal I/O you do could just be a dummy byte
saying "I/O ready, go do your thing!".

By the way, netlink sockets are very, very easy to use, and
pretty fast.  You might try 'em out.
- Dan


Re: Sending signals from the kernel to user space
X-No-Archive:yes

A certain Dan Kegel, of comp.os.linux.embedded "fame", writes :

Quoted text here. Click to load it

Thanks for that tip - I just googled for that, and the technique seems
to provide a standard way of implementing this kind of communication -
sounds ideal.

--

"Jokes mentioning ducks were considered particularly funny." - cnn.com


Site Timeline