Chapter 21: Signals: Signal Handlers

This chapter continues the description of signals begun in the previous chapter. It focuses on signal handlers, and extends the discussion started in Section 20.4. Among the topics we consider are the following:
  • how to design a signal handler, which necessitates a discussion of reentrancy and async-signal-safe functions;
  • alternatives to performing a normal return from a signal handler, in particular, the use of a nonlocal goto for this purpose;
  • handling of signals on an alternate stack;
  • the use of the sigaction() SA_SIGINFO flag to allow a signal handler to obtain more detailed information about the signal that caused its invocation; and
  • how a blocking system call may be interrupted by a signal handler, and how the call can be restarted if desired.

21 Signals: Signal Handlers
21.1 Designing Signal Handlers
        21.1.1 Signals Are Not Queued (Revisited)
        21.1.2 Reentrant and Async-signal-safe Functions
        21.1.3 Global Variables and the sig_atomic_t Data Type
21.2 Other Methods of Terminating a Signal Handler
        21.2.1 Performing a Nonlocal Goto from a Signal Handler
        21.2.2 Terminating a Process Abnormally: abort()
21.3 Handling a Signal on an Alternate Stack: sigaltstack()
21.4 The SA_SIGINFO Flag
21.5 Interruption and Restarting of System Calls
21.6 Summary
21.7 Exercises

No comments:

Post a Comment