public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Sending siginfo from kernel to user space
@ 2004-09-02  8:31 JobHunts02
  0 siblings, 0 replies; only message in thread
From: JobHunts02 @ 2004-09-02  8:31 UTC (permalink / raw)
  To: linux-kernel

I am sending a signal from kernel space to user space with Linux 2.4.20-8.  



In user space, I have installed a signal handler:


    saio.sa_handler = signal_handler_IO;

    sigemptyset(&saio.sa_mask);

    saio.sa_flags = SA_SIGINFO;

    saio.sa_restorer = NULL;

    sigaction(SA_SIGINFO, &saio, NULL);



In kernel space:


    info.si_errno = 1212;

    info.si_code  = SI_KERNEL;

    send_sig_info(SA_SIGINFO, &info, find_task_by_pid(pid));



This results in the signal handler, 


    void signal_handler_IO (int status, struct siginfo *info, void *p) 


being called in user space, which gives the following values in info:


    info->si_signo = 4  /* corresponds to SA_SIGINFO */

    info->si_errno = 0  /* expect 1212               */

    info->si_code  = 0  /* expect SI_KERNEL (128)    */ 

 


Note that the values I put in si_errno and si_code do not get passed to the 
user.  si_signo has the correct value, but the user can know this from the 
original sigaction call.



If instead, I call send_sig_info(SA_SIGINFO, (struct siginfo*)0, 
find_task_by_pid(pid)), as expected I get:


    info->si_signo = 4  

    info->si_errno = 0

    info->si_code  = 0  /* corresponds to SI_USER, as expected */



If I call send_sig_info(SA_SIGINFO, (struct siginfo*)1, 
find_task_by_pid(pid)), as expected I get:


    info->si_signo = 4  

    info->si_errno = 0

    info->si_code  = 128    /* corresponds to SI_KERNEL, as expected */



Apparently, there is a problem copying the info structure.  I need to pass 
info to the kernel.  Any ideas?



Thank you.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-02  8:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-02  8:31 Sending siginfo from kernel to user space JobHunts02

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox