To receive a signal from the kernel to user space, use the following code in your user space and the kernel code as follows:
user space:
signal(SIGIO, &signal_handler_func);
fcntl(fd, F_SETOWN, getpid());
oflags = fcntl(fd, F_GETFL);
fcntl(fd, F_SETFL, oflags | FASYNC);
Define the signal_handler_func function :
void signal_handler_func (int sig)
{
}
Core Space Module:
int ret = 0;
struct siginfo info;
memset(&info, 0, sizeof(struct siginfo));
info.si_signo = SIG_TEST;
info.si_code = SI_QUEUE;
info.si_int = 1234;
send_sig_info(SIG_TEST, &info, t);
t is the PID of the user application.
Raulp source
share