Delivering a Signal
We assume that the kernel noticed the arrival of a signal and invoked one of the functions mentioned in the previous section to prepare the process descriptor of the process that is supposed to receive the signal. But in case that process was not running on the CPU at that moment, the kernel deferred the task of delivering the signal. We now turn to the activities that the kernel performs to ensure that pending signals of a process are handled.
As mentioned in Section 4.8, the kernel
checks the value of the sigpending flag of the
process descriptor before allowing the process to resume its
execution in User Mode. Thus, the kernel checks for the existence of
pending signals every time it finishes handling an interrupt or an
exception.
To handle the nonblocked pending signals, the kernel invokes the
do_signal( ) function, which receives two
parameters:
-
regs The address of the stack area where the User Mode register contents of the current process are saved.
-
oldset The address of a variable where the function is supposed to save the bit mask array of blocked signals. It is
NULLif there is no need to save the bit mask array.
The do_signal( ) function starts by checking
whether the function itself was triggered by an interrupt; if so, it
simply returns. Otherwise, if the function was triggered by an
exception that was raised while the process was running in User Mode,
the function continues executing:
if ((regs->xcs & 3) != 3)
return 1;However, as we’ll see in ...