Results 1 to 1 of 1
I'm trying to use pselect() to handle kernel driver signals (i.e. SIGINT, SIGIO, etc) as well as file descriptor notices, which is all within the realm of things pselect() can ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-10-2011 #1
- Join Date
- May 2011
Generating signals for pselect()
I'm trying to use pselect() to handle kernel driver signals (i.e. SIGINT, SIGIO, etc) as well as file descriptor notices, which is all within the realm of things pselect() can do, however I'm having a hard time stimulating my implementation to test it. I need help figuring out how to generate kernel signals such as SIGINT, SIGIO and make pselect() detect them.
I was wondering if anyone knew of a way to check out the pselect() signal handling functionality? I was trying to do this with the Linux serial port drivers, but fell short since I don't know how to make the ttyS0 driver generate a signal so that pselect() can be interrupted and the signal handled?
Here's a snippet of code for how I'm using the pselect().
sigset_t emptyset, blockset;
sigemptyset(&blockset); /* Block SIGINT */
sigprocmask(SIG_BLOCK, &blockset, NULL);
sa.sa_handler = handler; /* Establish signal handler */
sa.sa_flags = 0;
sigaction(SIGINT, &sa, NULL);
/* Initialize nfds and readfds, and perhaps do other work here */
/* Unblock signal, then wait for signal or ready file descriptor */
ready = pselect(nfds, &readfds, NULL, NULL, NULL, &emptyset);