LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Signal from driver: zeroes in siginfo_t (https://www.linuxquestions.org/questions/linux-kernel-70/signal-from-driver-zeroes-in-siginfo_t-945670/)

eternal_ego 05-18-2012 03:35 AM

Signal from driver: zeroes in siginfo_t
 
Hi!

I'm using angstrom linux 2.6.25.5-1.1-pae.

I'm sending some signal from my driver to my user application by calling send_sig_info:

Code:

siginfo_t usig;

usig.si_signo = -SIGUSR2;
usig.si_code = SI_QUEUE;
usig.si_errno = any_integer_variable;
usig.si_value.sival_int = any_other_integer_variable;

send_sig_info(SIGUSR2,&usig,task_ptr);

and in user application:

Code:


static struct sigaction siga;

void mysig_handler(int i, siginfo_t* info, void* f) {
    //code that just checks what I've got in info
}

int main(void) {
//some code before

siga.sa_flags = SA_SIGINFO;
siga.sa_sigaction = mysig_handler;

sigaction(SIGUSR2,&siga,NULL);

//other code after
}

As result, my application receives that signal from driver, but siginfo_t in handler was filled by zeroes! I've tried another si_code in driver (SI_ASYNCIO, SI_USER) - but info remains zero-filled.
Then I had some investigation iside signal.c and I'm sure now that my siginfo_t remains correct in __send_signal function, after copying to new struct sigqueue *q... but then i was lost in kernel code.

Please don't ask me why I need to send signal from driver in kernelspace to application in userspace :)

I'm just wondering what happens with siginfo_t ? What code should I write to get it correct? I guess problem is located in driver (sending) code, because application can successfully send signal to itself with correct si_value.sival_int.

Thanks in advance!


All times are GMT -5. The time now is 03:39 PM.