将信号从linux驱动程序传递到用户应用程序

将信号从linux驱动程序传递到用户应用程序,linux,Linux,我的问题是关于如何使用send_sig_info和sigaction函数将信号从驱动程序传递到用户应用程序,以发出中断信号。目前我的代码如下: //in driver's interrupt handler function ret = send_sig_info(SIGNAL_NUMBER, &info, t); //in user application struct sigaction sig; sig.sa_sigaction = read_proc; sig.sa_flag

我的问题是关于如何使用send_sig_info和sigaction函数将信号从驱动程序传递到用户应用程序,以发出中断信号。目前我的代码如下:

//in driver's interrupt handler function
ret = send_sig_info(SIGNAL_NUMBER, &info, t); 

//in user application
struct sigaction sig;
sig.sa_sigaction = read_proc;
sig.sa_flags     = SA_SIGINFO;
sigaction(SIGNAL_NUMBER, &sig, NULL);
//in driver handler 1
info.si_int   =info.si_int+1;
//set the appropriate signal number
info.si_signo = SIGNAL_NUMBER;
ret = send_sig_info(SIGNAL_NUMBER, &info, t); 

//in drivers handler 2
info.si_int   =info.si_int+1;
//set the appropriate signal number
info.si_signo = SIGNAL_NUMBER2;
ret = send_sig_info(SIGNAL_NUMBER2, &info, t); 
其中read_proc是用户应用程序的处理函数。我现在正试图修改代码,以便在多次中断的情况下,将不同的信号号发送给用户应用程序,以便调用其相应的处理程序,如下所示:

//in driver's interrupt handler function
ret = send_sig_info(SIGNAL_NUMBER, &info, t); 

//in user application
struct sigaction sig;
sig.sa_sigaction = read_proc;
sig.sa_flags     = SA_SIGINFO;
sigaction(SIGNAL_NUMBER, &sig, NULL);
//in driver handler 1
info.si_int   =info.si_int+1;
//set the appropriate signal number
info.si_signo = SIGNAL_NUMBER;
ret = send_sig_info(SIGNAL_NUMBER, &info, t); 

//in drivers handler 2
info.si_int   =info.si_int+1;
//set the appropriate signal number
info.si_signo = SIGNAL_NUMBER2;
ret = send_sig_info(SIGNAL_NUMBER2, &info, t); 
在用户应用程序方面

struct sigaction sig;
sig.sa_sigaction = read_proc;
sig.sa_flags     = SA_SIGINFO;
sigaction(SIGNAL_NUMBER, &sig, NULL);

//sigaction for other buffers
struct sigaction sig2;
sig.sa_sigaction = read_proc2;
sig.sa_flags     = SA_SIGINFO;
sigaction(SIGNAL_NUMBER2, &sig2, NULL);
但是,在这种情况下,不调用函数read_proc2。有人能建议适当的解决方案,以便根据不同的策略在用户应用程序端调用不同的函数吗

问候,