Generating a Signal

Many kernel functions generate signals: they accomplish the first phase of signal handling—described earlier in the section "The Role of Signals“—by updating one or more process descriptors as needed. They do not directly perform the second phase of delivering the signal but, depending on the type of signal and the state of the destination processes, may wake up some processes and force them to receive the signal.

When a signal is sent to a process, either from the kernel or from another process, the kernel generates it by invoking one of the functions listed in Table 11-9.

Table 11-9. Kernel functions that generate a signal for a process

Name

Description

send_sig( )

Sends a signal to a single process

send_sig_info( )

Like send_sig( ), with extended information in a siginfo_t structure

force_sig( )

Sends a signal that cannot be explicitly ignored or blocked by the process

force_sig_info( )

Like force_sig( ), with extended information in a siginfo_t structure

force_sig_specific( )

Like force_sig( ), but optimized for SIGSTOP and SIGKILL signals

sys_tkill( )

System call handler of tkill( ) (see the later section "System Calls Related to Signal Handling“)

sys_tgkill( )

System call handler of tgkill( )

All functions in Table 11-9 end up invoking the specific_send_sig_info( ) function described in the next section.

When a signal is sent to a whole thread group, either from the kernel or from another process, the kernel generates it by invoking ...

Get Understanding the Linux Kernel, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.