struct task_struct {

struct signal_struct *signal; struct sighand_struct *sighand;

sigset_t blocked; struct sigpending pending;

unsigned long sas_ss_sp; size_t sas_ss_size;

^Another version that passes more information exists for handler functions used with POSIX real-time signals.

12Instead of repeatedly running through an empty loop to wait for a signal (a senseless waste of CPU time because the process is always running in this approach), the program can happily devote itself to doing nothing without burdening the CPU — the kernel automatically wakes the process when the signal arrives and can use CPU time more profitably in the meantime.

Although signal handling takes place in the kernel, the installed signal handlers run in user mode — otherwise, it would be very easy to introduce malicious or faulty code into the kernel and undermine the system security mechanisms. Generally, signal handlers use the user mode stack of the process in question. However, POSIX mandates the option of running signal handlers on a stack set up specifically for this purpose (using the sigaltstack system call). The address and size of this additional stack (which must be explicitly allocated by the user application) are held in sas_ss_sp and sas_ss_size, respectively.13

The sighand element with the following structure is used to manage information on the signal handlers installed. The underlying structure is essentially defined as follows:

Continue reading here: Info

Was this article helpful?

0 0