Linux Kernel Hacking

Textbooks

Links

Signals
The Role of Signals
Actions Performed upon Reeiving a Signal
Data Structures Associated with Signals
Operations on Signal Data Structures
Sending a Signal
Receiving a Signal
Ignoring the Signal
Executing the Default Action for the Signal
Catching the Signal
System Calls Related to Signal Handling

Signals

The Role of Signals

Actions Performed upon Receiving a Signal

Data Structures Associated with Signals

Operations on Signal Data Structures

Sending a Signal

  • When a signal is sent to a process, the kernel calls one of four functions to perform the first phase. These four functions are
  • 
       int send_sig_info(int sig, struct siginfo *info, struct task_struct *t)
    
       /*
        * Force a signal that the process can't ignore: if necessary
        * we unblock the signal and change any SIG_IGN to SIG_DFL.
        */
       int force_sig_info(int sig, struct siginfo *info, struct task_struct *t)
    
       void force_sig(int sig, struct task_struct *p)
    
       int send_sig(int sig, struct task_struct *p, int priv)
    
       the last two are for backwards compatibility and mearly call the first two.
    
    
  • the book has a pretty good explaination of send_sig_info on page 258
  • the book's explanation is limited on force_sig_info but thats because it ends up calling send_sig_info eventually
  • Receiving a Signal

    System Calls Related to Signal Handling

    
    GCC INLINE ASSEMBLY OPERAND CONSTRAINTS
    `r' 
       A register operand is allowed provided that it is in a general register.
    `I', `J', `K', ... `P' 
       Other letters in the range `I' through `P' may be defined in a machine-dependent fashion to permit
       immediate integer operands with explicit integer values in specified ranges. For example, on the 68000, `I'
       is defined to stand for the range of values 1 to 8. This is the range permitted as a shift count in the shift
       instructions.
    `m' 
       A memory operand is allowed, with any kind of address that the machine supports in general.
    `=' 
       Means that this operand is write-only for this instruction: the previous value is discarded and replaced by
       output data.