Implementation to handle high-volume signals with an alternate signal stack

Here's an attempt at precisely that: the code for ch11/altstack.c and a run-time test. Also, we have added a neat feature (to the previous version: the defer_or_not program): sending the process SIGUSR2 signal will have it print out the first and the most recent stack pointer address. It will also calculate and display the delta—in effect, the amount of stack memory used so far by the application.

Changes from ch11/defer_or_not.c:

  • We also trap the signals.
    • SIGUSR2: to display the first and the most-recent stack pointer addresses and the delta between them.
    • SIGSEGV : this is important in real-world applications. Trapping the segfault allows us to take control if ...

Get Hands-On System Programming with Linux 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.