Re: AW: Send Signal to application from kernel module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I had a similar situation for an userland driver I wrote once. Here's an
alternative suggestion to achieve what youre trying to do:

 Thread your app. In the main thread (for e.g.), use the select system call
to wait for the interrupt event (in your module, define a poll method in
your fops for the device file that will wake the app waiting on select),
and once the main thread is woken up, signal the interrupt handler in your
app to do its job and go back to waiting on select in the main thread.

 Regards,
-Saugata.



                                                                                                                                            
                      "Juergen Oberhofer"                                                                                                   
                      <j.oberhofer@gmx.at>          To:       <krishnakumar@naturesoft.net>                                                 
                      Sent by:                      cc:       "'Rahul Sahgal'" <sahgal@cdacindia.com>, <kernelnewbies@nl.linux.org>         
                      kernelnewbies-bounce@n        Subject:  AW: Send Signal to application from kernel module                             
                      l.linux.org                                                                                                           
                                                                                                                                            
                                                                                                                                            
                      11/26/2003 12:31 AM                                                                                                   
                                                                                                                                            
                                                                                                                                            




OK, I'll try this, thanks! I've another question:
I have a module and an application program:

Module: at init it initializes a timer register of the mpc823, such that
an interrupt is generated every x milliseconds. Thus, I installed an
interrupt handling function f that handles the timer interrupts.

The problem is that the module / the interrupt handling function should
execute a procedure defined in the application program. Is there a way
to pass a pointer (which points to that function) from the appl.program
to the module, such that the handler can execute this function every x
milliseconds?
I thought to create a procedure in the module that accepts a function
pointer as argument. But how can I achieve, that this module procedure
is
visible to the application program?

Regards,
Juergen

>Hi,
>
>You can create a proc
>entry, or a device entry
>through which you can register
>the pid of the process to which
>you want to send the signal.
>
>some thing like
>/proc/reg_pid
>
>--------------------------------
>echo <your pid> > /proc/reg_pid
>--------------------------------
>
>In the kernel write a handler for
>the proc entry which will store the pid
>is some place, lets say a variable.
>
>And whenever necessary just
>send the signal using the kill_proc
>to this pid.
>
>Hope this helps
>Regards
>KK





On Tue, 2003-11-25 at 23:44, Juergen Oberhofer wrote:
> hm the thing is, that the module doesn't know the pid of the user
process...
> I would need a function, equivalent to the
> int kill(pid_t pid, int sig);
> function, defined in signal.h. Because by setting pid = -1 the signal
is
> sent to
> every process except for process 1.
> Does there exist such a function for the kernel space? If not, does
somebody
> know what other possibilities do I have?
> regards
> juergen
>
>
> > hi,
> >   you can try
> >    kill_proc(pid,SIGUSR1,1);
> > thx
> > --rahul
> >
> > On Tue, 2003-11-25 at 19:18, Juergen Oberhofer wrote:
> > > Hi,
> > > is there a function to send a SIGUSR1 signal from a kernel module
to a
> > > program which
> > > runs in user space?
> > > Regards
> > > Juergen
>



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/






--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux